fork download
  1. #include<cstdio>
  2. #include<cstdlib>
  3. #include<set>
  4. #include<cstring>
  5. #include<iostream>
  6. using namespace std;
  7. int main()
  8. {
  9. char buf[100005];
  10. long long t;
  11. scanf("%lld\n",&t);
  12. while(t--)
  13. {
  14. char *token;
  15. set<string>ss;
  16. scanf("%[^\n]s",buf);
  17. char *p;
  18. for (p = strtok(buf," "); p != NULL; p = strtok(NULL, " "))
  19. {
  20. ss.insert(p);
  21. }
  22. cout<<ss.size()<<endl;
  23. ss.clear();
  24. scanf("%lld\n",&t);
  25. }
  26. }
Success #stdin #stdout 0s 2848KB
stdin
4
now do it now
now      do it now
I am  good boy
am am
stdout
3
3
4
1