Well, there are a few problems, i’ll just list them quickly
Firstly you didn’t take care of input at start,number of test cases
, you need to take a input (say T) and run the code inside a loop iterating T times
Secondly in the for loop, you need to check from i=0 to i=strlen(word)-1 and not ‘40’
You dont need this if condition
if(word[i]>=0 && word[i]<=9)
{
break;
}
Take out the getchar() at the end
Then it will be fine i hope, try the correction yourself and see if you get it right
edit : add a new line after printing “holes”
Cheers
P.S - you can check my last submission of this problem, i did the mentioned changes and submitted it
I did not understand by what means you gave the loop till i<=40.
Shouldn’t it be i<strlen(word)?
Then in the question it is clearly given that the characters in the text will be from ‘A’-‘Z’
You need not check that case…Even if you check it it will not cause any wrong answer.But if we are sure that such a thing does not exist then why do we need to waste the time for checking that?
Moreover we need not pause the output instead using getchar().
Hope you got what i meant…
Happy coding…
you Should make a loop like “for(j=0;j< i;j++)” where “i = strlen(word)” instead of “for(i=0;i<=40;i++)”
you don’t need to check the given input… in the text file only capital letters are allowed(A-Z) so you don’t need to add extra if condition… “if(word[i]>=0 && word[i]<=9)”.
i just input the answer like this. but keep wrong answer. i don’t know why. if i input 2 the output is 0. if i input other words it can compiled succesfully.
You still did not take the number of test cases, you need to take an int input first (say T) and then input word T time,
You don’t need to put the getchar() at the end.
Lastly while inputing the string in word[100], the scanf statement you used is wrong, “&word” is not correct, it should be either only “word” or “&word[0]”