Amazon interview question

Coding question related to RegEx expression