Domanda di colloquio di Bjak

Was asked a string manipulation problem,