Pergunta de entrevista da empresa Salesforce

Puzzle, Programming question on Strings