fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main ()
  4. {
  5. int T;
  6. scanf("%d",&T);
  7. while(T--)
  8. {
  9. set <string> b;
  10. char a[100001];
  11. scanf(" %[^\n]s",a);
  12. int l=strlen(a),i=0,j=0;
  13. string v;
  14. while(1)
  15. {
  16. while((i<l)&&(a[i]==' ')) i++;
  17. if(i==l) break;
  18. while((i<l)&&(a[i]!=' ')) {v+=a[i];i++;}
  19. b.insert(v);//cout<<v<<"\n";
  20. v.clear();
  21. if(i==l) break;
  22. }
  23. printf("%d\n",b.size());
  24. }
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 3436KB
stdin
Standard input is empty
stdout
Standard output is empty