This Competitive Programming question can be solved by a simple Regular Expression!
The Problem   Adapted from ICPC Indonesia National Contest (INC) 2014, Problem H  Someone is...
Tags: todayilearned, competitiveprogramming, regex