Pergunta de entrevista da empresa Morgan Stanley

Rearrange characters in a String such that no two adjacent characters are same