Google Interview Question

String parsing problem, but I forget how it went.