```
public int[] findPermutation(String s) {
int n = s.length();
int[] res = new int[n+1];
for(int i = 0, f = 0; i < n + 1; i++) {
if(i < n && s.charAt(i) == 'D')
continue;
for(int k = i + 1; f <= i; f++)
res[f] = k--;
}
return res;
}
```