首页 > 代码库 > Uva 12889 One-Two-Three

Uva 12889 One-Two-Three

 

Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize them. Note that your little brother is only a child, so he may make small mistakes: for each word, there might be at most one wrong letter. The word length is always correct. It is guaranteed that each letter he wrote is in lower-case, and each word he wrote has a unique interpretation.

Input 

The first line contains the number of words that your little brother has written. Each of the following lines contains a single word with all letters in lower-case. The words satisfy the constraints above: at most one letter might be wrong, but the word length is always correct. There will be at most 10 words in the input.

Output 

For each test case, print the numerical value of the word.

Sample Input 

3owetootheee

Sample Output 

123

 

 1 #include<iostream>   2 #include<string.h>   3 #include<stdio.h>   4 #include<ctype.h>   5 #include<algorithm>   6 #include<stack>   7 #include<queue>   8 #include<set>   9 #include<math.h>  10 #include<vector>  11 #include<map>  12 #include<deque>  13 #include<list>  14 using namespace std;  15 int main()16 {17     int m;18     cin>>m;19     while(m--)20     {21     char s[10];22     cin>>s;23     int n=strlen(s);24     if(n==5)25     printf("3\n");26     else if((s[0]==o&&s[1]==n)||(s[1]==n&&s[2]==e)||(s[0]==o&&s[2]==e))27     printf("1\n");28     else29     printf("2\n");30     }31     return 0;32 }
View Code