fork download
  1. #include <stdio.h>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. int count;
  7. scanf("%d",&count);
  8. string word;
  9. for(int c=0;c<count;c++)
  10. {
  11. cin>>word;
  12. if(word.size()>3)
  13. {
  14. printf("%d\n",3);
  15. }
  16. else
  17. {
  18. if((word[0]=='t' && word[1]=='w') || (word[1]=='w' && word[2]=='o') || (word[0]=='t' && word[2]=='o'))
  19. {
  20. printf("%d\n",2);
  21. }
  22. else
  23. {
  24. printf("%d\n",1);
  25. }
  26. }
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 3232KB
stdin
14
owe
too
theee
ote
owe
tne
txo
ont
wwo
wne
twx
one
two
three
stdout
1
2
3
1
1
1
2
1
2
1
2
1
2
3