Help in chef and his character

https://www.codechef.com/viewsolution/33143690
Please tell the problem in my program output is coming correct in comipler but it is showing wrong answer ,
please check this out

Something like while(s[i+3]!='\0') is often dangerous, and will certainly fail you for small strings on this problem (for example, n = 1). It’s probably a better idea (for this problem, and in general) to use C++ style strings, as they’re much more convenient.

1 Like

yes galencolin Sir has absolutely said the right thing.that comparison is making everything wrong.What you can simply do is check until i+3>=length_of_string.I did so and AC ed your solution…

1 Like

the condition will be i+3<length_of_string in the while loop

1 Like

Thanks you buddy…

1 Like

thanks for help…

welcome!!!Very delighted to help you