12289-one-two-three
Time limit:1.000 seconds
Http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&category=244&page=show_ problem&problem=3710
Your little brother has just learnt to write one, two and three, in 中文版. He has written a lot of the those words in a paper, your task are to recognize them. Note This your little brother is only "a" child, "so he" make small mistakes:for all word, there might be at most one WR Ong letter. The word length is always correct. It is guaranteed which each letter he wrote was in lower-case, and all word he wrote has a unique interpretation.
Input
The contains the number of words that your little brother has. 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 as wrong, but the word length is always correct. There would be on most 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
This is still lrj out of the problem.
Complete code:
/*0.016s*/
#include <cstdio>
#include <cstring>
const char one[] = "one";
Char s[10];
int main ()
{
int T, I, C;
scanf ("%d\n", &t);
while (t--)
{
gets (s);
if (strlen (s) = = 5) puts ("3");
else
{
c = 0;
for (i = 0; i < 3; ++i) if (s[i] = = One[i]) ++c;
Puts (C > 1?) "1": "2");
}
return 0;
}
Author: csdn Blog Synapse7
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/