Pergunta de entrevista da empresa JPMorganChase

Questions about string and some simple greedy algorithm