首页 > 其他 > 详细

Uva 12889 One-Two-Three

时间:2014-07-19 09:31:31      阅读:349      评论:0      收藏:0      [点我收藏+]
 

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 

3
owe
too
theee

Sample Output 

1
2
3

 

bubuko.com,布布扣
 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     else
29     printf("2\n");
30     }
31     return 0;
32 }
View Code

Uva 12889 One-Two-Three,布布扣,bubuko.com

Uva 12889 One-Two-Three

原文:http://www.cnblogs.com/qscqesze/p/3854227.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!