Pergunta de entrevista da empresa Thought Machine

One string parsing algorithms question of medium difficulty.