Amazon Interview Question

find a pattern from a string