Given a string S that only contains “I” (increase) or “D” (decrease), let N = S.length.
Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1:
If S[i] == "I", then A[i] < A[i+1]If S[i] == "D", then A[i] > A[i+1]Highest vote answer is not easy to understand. So I wrote my own. When the char is I, current number should be larger than the next one and when the char is D, should be smaller than the next one. So actually, it is increasing and decresing. We set highest as the size of S and start from 0. when the for loop finishes, we put the last one into res
