Pregunta de entrevista de Goldman Sachs

Based on string manipulation and patterns