You are given a string as an input. Rearrange the characters of the string such that no character appears in its original position.
If the rearrangement is possible, print the rearranged string else print 'Not possible'.
Sample Input:
Case 1:
aabccbadd
Case 2:
abaab
Sample Output:
Case 1:
dcaabcdab(It is one of the possible valid rearrangements of 'aabccbadd')
Case 2:
Not possible
It looks like you're new here. If you want to get involved, click one of these buttons!