/ OPS / 题库 /

signature

signature

#描述#
The signature of a permutation is a string that is computed as follows: for each pair of consecutive elements of the permutation, write down the letter 'I' (increasing) if the second element is greater than the first one, otherwise write down the letter 'D' (decreasing).
<BR>
<BR>
For example, the signature of the permutation {3,1,2,7,4,6,5} is "DIIDID".
Your task is to reverse this computation: You are given a string signature containing the signature of a permutation. Find and return the lexicographically smallest permutation with the given signature.

#格式#
##输入格式##
multi test case.
For each case, one string which contains only 'I' and 'D' represent the signature of the result permutation. I confirm the length of the string is less than 1000.

##输出格式##
the permutation of length signature.length()+1

#样例1#
##样例输入1##

I
DD
DIDII

##样例输出1##

1 2
3 2 1
2 1 4 3 5 6

#限制#
1000ms
32768KB

#提示#

#来源#

信息

ID
1783
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者