填寫問券˙抽7-11禮券6檔好股票放一年賺5成輕忽小中風,當心變殘障反服貿流血 法官要警交...
2011-12-03 17:37:19 人氣(289) | 回應(0) | 推薦(0) | 收藏(0) 上一篇 | 下一篇

[UVA] 12289 - One-Two-Three

0
收藏
0
推薦

  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 

3
owe
too
theee

Sample Output 

1
2
3


 

#include<stdio.h>
#include<string.h>
int main() {
    int T;
    char s[6];
    scanf("%d", &T);
    while(T--) {
        scanf("%s", s);
        if(strlen(s) == 5)    puts("3");
        else {
            int t = 0;
            if(s[0] == 'o')    t++;
            if(s[1] == 'n')    t++;
            if(s[2] == 'e') t++;
            puts(t >= 2 ? "1" : "2");
        }
    }
    return 0;
}

12289One-Two-Three
台長:Morris
人氣(289) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類 | 個人分類: UVA |
此分類下一篇:[UVA] 12342 - Tax Calculator
此分類上一篇:[UVA] 11984 - A Change in Thermal Unit

我要回應
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入以下數字 (ex:123)

(有*為必填)
詳全文