https://www.hackerrank.com/challenges/sherlock-and-the-beast