#include<iostream>#include<cstring>#include<cstdio>using namespace std;int main(){ char a[10000],*p,word[10000][10000]; //用二维数组来存多个字符串 int i,j; while(cin.get(a,10000)) { if(strcmp(a,"#")==0) break; else { int n=0; p=strtok(a," "); for(i=0;p!=NULL;i++) { strcpy(word[i],p); p=strtok(NULL," "); } for(int k=0;k<i;k++) for(j=k+1;j<i;j++) if(strcmp(word[k],word[j])==0) { n++; break; } cout<<i-n<<endl; } } return 0;}
onemoo
onemoo
相关分类