Question: C Programming Language The code below gives the correct answer but is marked wrong in the checking software. Is there any alternative ways to do
C Programming Language

The code below gives the correct answer but is marked wrong in the checking software. Is there any alternative ways to do this problem? The focus is on functions and recursion
#include
#include
int checkString(char string[])
{
for(int i = 0; i
{
if(string[i] == 103 || string[i] == 71 && string[i+1] == 111 || string[i+1] == 79 && string[i+2] == 111 || string[i+1] == 79 && string[i+3] == 100 || string[i+1] == 68)
{
return 1;
break;
}
}
}
int goodCheck()
{
char string[80] = {'0'};
fgets(string, 80, stdin);
if(checkString(string)==1)
{
return 3;
}
else
{
return 0;
}
}
int main()
{
int cases = 0;
char string[80];
scanf("%d", &cases);
fflush(stdin);
for(int i = 1; i
{
if (goodCheck() == 3)
{
printf("Case #%d: yes ", i);
}
else
{
printf("Case #%d: no ", i);
}
}
}
Good In this problem, you should check whether there is 'good' or not in a line Format Input The input begins with an integer T indicating the number of test cases. In each test case, there is a line of string S Format Output For each line of input, print yes if the line contains 'good', and no otherwise. Any capitalization of 'good counts as an occurrence Constraints 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
