2nd codechef MAY13 challenge solved