Solution for Code Chef Problem 'TEST' (http://www.codechef.com/problems/TEST)