#include <bits/stdc++.h> using namespace std; int main() { char s[101],l; int i,tc,ans; cin>>tc; while(tc--) { scanf("%s",s); l=strlen(s); if(l<=3) { if(s[0] =='o'&&s[1]=='n'&& s[2] == 'e' || s[0] == 'o' && s[1] == 'n' || s[0] == 'o' && s[2] == 'e' ||s[1] == 'n' && s[2] == 'e') printf("1\n"); else if(s[0] == 't' && s[1] == 'w' && s[2] == 'o'||s[0] == 't' && s[1] == 'w' ||s[0] == 't' && s[2] == 'o'||s[1] == 'w' && s[2] == 'o' ) printf("2\n"); } else cout<<"3"<<endl; } return 0; }