Hi, @vjozic
In any online environment, be it codechef or spoj or topcoder never ever use user prompts unless you are told to! Always follow the strict input and output formats specified!
Look at the test cases given carefully! Simply take the number of cases, strings and output number of holes for each case in new line, is what you are asked to do!
So, remove all prompts like "Enter the word: " and "Number of holes: " etc.
Expcet that, in a quick look, your logic seems to be correct! Try removing extra lines as i mentioned it should work! Let me know if it doesn’t!