HEADBOB - Getting WA when using %c (stdin buffer) and not %s

When I scan the input buffer (gesture string) character by character, I get WA here but not in my CodeBlocks IDE.

When using %s or storing the string in one go into an array, my code gets accepted here.

I have read a similar query here and I assume this is associated with the way stdin works over characters and string array along with input buffers. Can someone help me with a deep explanation of why this works on my IDE but not here? Any words over this would be highly appreciated.

this is the reason for your wrong answer:

you are breaking the for loop without taking the whole input,then what happens is remaining input is taken as the input for the next testcase .

try this testcase:

2

3

YNI

3

NIN

1 Like