Skip to content

Instantly share code, notes, and snippets.

@raryosu
Created July 5, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raryosu/0e94a754b3bfd82c8434 to your computer and use it in GitHub Desktop.
Save raryosu/0e94a754b3bfd82c8434 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void ToupperStr(char str[]){ // a -> A , A -> A
int i=0;
while(str[i]!='\0'){
str[i] = toupper((int)str[i]);
i++;
}
}
int main(){
char str[1001],word[11];
int sum=0;
scanf("%s",word);
ToupperStr(word);
while(1){
scanf("%s",str);
if(strcmp(str,"END_OF_TEXT")==0)break;
ToupperStr(str);
if(strcmp(str,word)==0)sum++;
}
printf("%d\n",sum);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment