Meta Interview Question

Checking certain patterns of the given string.