一二三

你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?
输入

第一行为单词的个数(不超过10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。

输出

对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。

样例输入

3

owe

too

theee

样例输出

1

2

3

分析:此题就是一一对比字符串的符合,因为只有三种情况,前两种都是三位,所以一起比较,最后一个单独比较,直接比较,计一个临时变量就可

代码:

#include<iostream>
#include<string.h>
using namespace std;
int main(){
char s[10];
string s1="one";
string s2="two";
string s3="three";
int T;
int i,j;
cin>>T;
while(T--){
int len;
int temp1=0,temp2=0,temp3=0;
cin>>s;
len=strlen(s);
if(len==3){
for(i=0;i<3;i++){
if(s[i]==s1[i]){temp1++;}
if(s[i]==s2[i]){temp2++;}
}
if(temp1>=2){cout<<"1"<<endl;}
if(temp2>=2){cout<<"2"<<endl;}
}
if(len==5){
for(j=0;j<5;j++){
if(s[j]==s3[j]){temp3++;}
}
if(temp3>=4){cout<<"3"<<endl;}
}
}
return 0;
}


一二三(The Seventh Hunan Collegiate Programming Contest)的更多相关文章

  1. 盒子游戏(The Seventh Hunan Collegiate Programming Contest)

    盒子游戏 有两个相同的盒子,其中一个装了n个球,另一个装了一个球.Alice和Bob发明了一个游戏,规则如下:Alice和Bob轮流操作,Alice先操作.每次操作时,游戏者先看看哪个盒子里的球的数目 ...

  2. The Ninth Hunan Collegiate Programming Contest (2013) Problem A

    Problem A Almost Palindrome Given a line of text, find the longest almost-palindrome substring. A st ...

  3. The Ninth Hunan Collegiate Programming Contest (2013) Problem F

    Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roa ...

  4. The Ninth Hunan Collegiate Programming Contest (2013) Problem H

    Problem H High bridge, low bridge Q: There are one high bridge and one low bridge across the river. ...

  5. The Ninth Hunan Collegiate Programming Contest (2013) Problem I

    Problem I Interesting Calculator There is an interesting calculator. It has 3 rows of button. Row 1: ...

  6. The Ninth Hunan Collegiate Programming Contest (2013) Problem J

    Problem J Joking with Fermat's Last Theorem Fermat's Last Theorem: no three positive integers a, b, ...

  7. The Ninth Hunan Collegiate Programming Contest (2013) Problem G

    Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...

  8. The Ninth Hunan Collegiate Programming Contest (2013) Problem L

    Problem L Last Blood In many programming contests, special prizes are given to teams who solved a pa ...

  9. The Ninth Hunan Collegiate Programming Contest (2013) Problem C

    Problem C Character Recognition? Write a program that recognizes characters. Don't worry, because yo ...

随机推荐

  1. IE浏览器下安装firebug

    第一步: 将一个网址拖动到地址收藏栏: 第二步: 第三步: 将路径改为:javascript: var dd = (window["inIframe"] || window).do ...

  2. Python学习笔记 — 函数

    函数是对程序逻辑进行结构化或过程化的一种编程方法.函数具有两个方面的意义:1)将代码分块,易于管理和阅读:2)最大化代码复用和最小化代码冗余,节省空间,有助于保持一致性. 1. 函数定义 Python ...

  3. linux环境: shell初始化文件, for TCSH, CSH

    TCSHELL, CSHELL 配置文件 全局配置文件 /etc/csh.cshrc个人配置文件 ~/.cshrc或~/.tcshrc 参考: 1.配置你的csh/tcsh,  https://wik ...

  4. 围观M$的new

    围观M$的new 对于new一个类, M$为了拷贝和移动时的效率问题, 使用了非标准的new语法, 为了兼容性, 只能围观. http://blog.csdn.net/lostspeed/articl ...

  5. WPF Popup 置顶问题

    原文 WPF Popup 置顶问题 问题: 使用wpf的popup,当在popup中弹出MessageBox或者打开对话框的时候,popup总是置顶,并遮住MessageBox或对话框. 解决: 写如 ...

  6. haproxy timeout server 46000 后台超时时间

    [root@wx03 ~]# sh ./1.sh Wed Jul 6 19:54:40 CST 2016 <html><body><h1>504 Gateway T ...

  7. 基于visual Studio2013解决面试题之0504单链表逆序

     题目

  8. 北京出dell s2740显示器 1900 - V2EX

    水木社区归档站 北京出dell s2740显示器 1900 - V2EX 北京出dell s2740显示器 1900 By kekex · 6 小时 6 分钟前 · 188 次点击 购于今年4月份 镜 ...

  9. 【实战】静默安装-oracle 11.2.0.3 on centos 5.10

    发现网上静默安装的文章非常多,乱七八糟,五花八门!来个扫盲的!   centos 5.10 下安装oracle 11g_r2 ************************************* ...

  10. 499 - What's The Frequency, Kenneth?

     What's The Frequency, Kenneth?  #include <stdio.h> main() { int i; char *suffix[]= { "st ...