zoukankan      html  css  js  c++  java
  • 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 

    3
    owe
    too
    theee
    

    Sample Output 

    1
    2
    3
    
     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
    ");
    26     else if((s[0]=='o'&&s[1]=='n')||(s[1]=='n'&&s[2]=='e')||(s[0]=='o'&&s[2]=='e'))
    27     printf("1
    ");
    28     else
    29     printf("2
    ");
    30     }
    31     return 0;
    32 }
    View Code
  • 相关阅读:
    第三次作业
    第二次作业
    第一次作业
    仪仗队(欧拉函数)
    自己随便做的,没做完就没耐心继续了。呵呵
    从别处见到一位大神的代码 飞扬的小鸟(flappy bird)
    简易迷宫游戏c++
    STL做法 平衡树
    基于百度地图api + AngularJS 的入门地图
    javascript 简易文本编辑器
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3854227.html
Copyright © 2011-2022 走看看