JetSynthesys interview question

Core Java, programming puzzles. Based on string manipulation.