Tulip Interview Question

String processing brain-teaser