HackerRank Java Regex problem solution - TheCScience