# include
Int main () {
Char m [100], word [9];
Int I, j, ans, counts=0, flag.
Gets (m); Gets (word);
for(i=0; i
{flag=j; break; }
If (flag
Ans=1;
For (j=I; j
Ans=0; break; }
}
If (strlen (word)!=flag - I) ans=0;
If (ans==1) counts++;
I=flag;
}
Printf (" % s % d ", a word, counts);
return 0;
}
If there are better and more understandable code is too good! Thank you very much!!!!!!
CodePudding user response:
The titleWord counts
Description
Input string string [N] (N 100) or less, each words separated by Spaces, word length less than or equal to 8, the input word word [M] (M 8) or less, find out the same words in a string and statistics the number of occurrences of the word information, and output word occurrences of information, empty one space between the data, the main function of the input string and statistical word, write function count () implementation of statistics and information output,
Time limit
1
Memory limit
10000
Category
1
The input description
Each word input line of characters separated by Spaces, input to statistical word,
The output shows that
Output format output: words and the number of occurrences of information, data between an empty one,
The input sample
ABC dog dog cat dog dog the hahe
Dog
The output sample
Dog 4
Tip
Calculation process is realized by using heavy circulation structure, output data between an empty one,
CodePudding user response: