Company: Intuit
Difficulty: medium
Rearrange String Problem body { font-family: Arial, sans-serif; line-height: 1.6; margin: 20px; } .problem-container { max-width: 800px; margin: auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #f9f9f9; } h1, h3 { color: #333; } pre { background: #f4f4f4; padding: 10px; border: 1px solid #ddd; border-radius: 5px; overflow-x: auto; } ul { margin: 0; padding-left: 20px; } .example { margin-top: 15px; } .example .input, .example .output { margin-bottom: 5px; } .explanation { font-style: italic; margin-top: 10px; } Rearrange String You have a string S . Your task is to rearrange some characters of the string (if needed) so that S[i] is not equal to S[L - i - 1] for each 0 ≤ i < (L - 1) / 2 , where L is the length of S . If multiple rearrangements exist, return the one that comes earliest alphabetically. If there is no answer, print \'impossible.\' Input Format The input contains the string S . Output Format Print \'impossible\' if there is no answer. Other