Firstly, scanf shouldn’t have the & when reading an array of char.
That said, I think there’s something wrong with the test data, but I’m getting very strange results. I added some asserts to check the length of the entered string, and some strings are apparently 21 characters long. But when I later re-ran the same program, the asserts now say the strings are 10 characters or less.
Anyway, it turns out there are multiple strings in the input, and you have to process them all.
edit: No, that’s not it. I can get accepted by initialising the string to an empty string.
So if the string is unitialised, and scanf isn’t reading anything, then that explains the strange, unrepeatable results I was getting,.
Does that mean that some of the test files are empty?
edit 2: I’ve noticed that this author has added several other problems that people are unable to get AC. I suspect he or she is not too good at verifying the test data.