Login
Immutable PageDiscussionInfoAttachments

Revision 1 as of 2012-05-11 18:21:23

Clear message
rei05/C言語/10022

MMA

#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(){

int counter=0,i;
char word[1000],sen[1000];

scanf("%s",word);
while(1){
  scanf("%s",sen);
    if(strcmp(sen,"END_OF_TEXT")==0) break;
  for(i=0;sen[i]!='\0';i++){
    sen[i]=tolower(sen[i]);
  }
  if(strcmp(sen,word)==0) counter++;
}

printf("%d\n",counter);

return(0);
}