Tripadvisor Interview Question

Question was about manipulating a string, fairly straightforward stuff.