Given a string with repeated characters, the task is to complete the function rearrangeString which rearrange characters in a string so that no two adjacent characters are same, and returns that transformed string.
Note : It may be assumed that the string has only lowercase English alphabets and such transformation is always always possible.
The first line of input contains an integer T denoting the no of T test cases.Then T test cases follow. The only line of every test case consists of String s.
For each test case output in the expected output will be 1 if the string returned by the function is valid else 0.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.