Hacker Rank :  Sherlock and the Beast