// UVa 12289 - One-Two-Three #include <iostream> #include <string> using namespace std; string word[4] = { "", "one", "two", "three" }; int main() { int n; for (cin >> n; n; n--) { string s; cin >> s; if (s.length() > 3) cout << "3\n"; else { int d[3]; for (int j = 1; j < 3; j++) { d[j] = 0; for (int i = 0; i < 3; i++) if (s[i] != word[j][i]) d[j]++; } if (d[1] < d[2]) cout << "1\n"; else cout << "2\n"; } } return 0; }
No comments:
Post a Comment