Tripadvisor interview question

Question was about manipulating a string, fairly straightforward stuff.