Please tell the problem in my program output is coming correct in comipler but it is showing wrong answer ,
please check this out
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.
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…
the condition will be i+3<length_of_string in the while loop
Thanks you buddy…
thanks for help…
welcome!!!Very delighted to help you