One-Two-Three (Uva)
2011-09-17 17:41
309 查看
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.
The Seventh Hunan Collegiate Programming Contest
Problemsetter: Rujia Liu, Special Thanks: Yiming Li & Jane Alam Jan
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
The Seventh Hunan Collegiate Programming Contest
Problemsetter: Rujia Liu, Special Thanks: Yiming Li & Jane Alam Jan
#include<stdio.h> #include<string.h> int main() { int n; char str[10]; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%s",&str); int len=strlen(str); if(len>3) printf("3\n"); else { if((str[0]=='o'&&str[1]=='n')||(str[0]=='o'&&str[2]=='e')||(str[1]=='n'&&str[2]=='e')) printf("1\n"); else printf("2\n"); } } return 0; }
相关文章推荐
- UVA 12289 One-Two-Three
- UVa 12289 One-Two-Three (water ver.)
- UVa 12289 - One-Two-Three
- UVa 12289 - One-Two-Three
- Uva 12889 One-Two-Three
- queue by one stack、two stack and three stack
- 12289 - One-Two-Three
- ChargeSystem——One,Two,Three
- ChargeSystem——One,Two,Three
- Project Euler17.数字1,2,3使用英文的表示为one,two,three,使用的英文的字母数的总和为3+3+5=11,现有1到1000,使用的英文字母数总和为多少?(空格和连接符不计)
- ASP杂谈ONE、TWO、THREE
- test one two three
- It's as simple as one,two ,three…
- 【ZT】少数派鲜活英语One,Two,Three...
- [解题报告]12289 - One-Two-Three
- 奥运英语[9]数字:1,2,3……10 Numbers: one, two, three...ten.
- UVa--12289 One-Two-Three
- 如何实现将'one,two,three,four,five' 分别打印
- 12289 - One-Two-Three
- UVA OJ 12289 One-Two-Three