Solved the TEST problem

I've solved the TEST problem(http://www.spoj.com/problems/TEST/) and I'm
uploading my solution code to it.