code answers wrong only on codechef compiler

http://www.codechef.com/viewplaintext/1650565

I saw the output of your program on sample input given with the problem
(It gives two spaces after every “on” , it should give only one to be correct ) .