Meta interview question

Checking certain patterns of the given string.