same program in java submitted but in c not

i have applied same logic to attic question of june cook of it was submitted in java but when i do it in c it is not submitted…it says wrong answer. why???

Kindly add links to your solutions.

In your C code, you need to add 1 to the size of the char ip[1000000] (and make it char ip[1000001]) to accomodate for the ‘\0’ in case of a string of length 1000000.

You can find it easily

C (WA): http://www.codechef.com/viewsolution/2293733
Java (AC): http://www.codechef.com/viewsolution/2293792