Balbix interview question

String parsing problem, not very difficult