Code for solving the problem Sherlock and Beast of Hackerrank