https://www.hackerrank.com/contests/101aug13/submissions/code/845233