Pregunta de entrevista de Amazon

Coding question related to RegEx expression