Tripadvisor interview question

The string tokenizing question that was already posted here.