Ankan's submission of Q18 | CodeChef