runtime error[ACMKAPD]

it is giving runtime error each time… i made small changes but all in vein…
http://ideone.com/KoYhtz is my solution
problem is: http://www.codechef.com/problems/ACMKANPD/

and i always waste my time in debugging my codes rather than making them…

[any useful tips so that it’s AC at one go???]

@hitesh091 You are using scanf() function to read a line of input, instead you should use gets(). scanf() reads until a whitespace character occurs, on the other hand gets() reads a line until newline or EOF character occurs.

Here is ideone link to your AC code.

[Solution][1]

Hope it helps, Best Luck :slight_smile:
[1]: http://ideone.com/fWAD5j

1 Like

i replaced scanf with gets in my code… but it’s still giving runtime error at codechef? http://www.codechef.com/viewsolution/2239106

why runtime error at codechef…