IBM interview question

String parsing