一二三

你弟弟刚刚学会写英语的一(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. C语言指针和数组知识总结(下)

    一.数组指针: 数组指针就是一个指针,只不过它指向的是一个数组.可以通过如下方式来定义 typedef int Array[5]; //数组类型 Array* m;      //数组定义 还有一种更 ...

  2. 重操JS旧业第二弹:数据类型与类型转换

    一 数据类型 1 js中的数据类型 1.1 数据类型列举 1)number类型 2)boolean类型 3)string类型 4)对象类型 5)函数类型 6)undefined类型 1.2 数据类型获 ...

  3. 融云(找到“每个App都有沟通的需求”的细分市场)

    近日,国内著名App驾考宝典和融云达成合作,为应用增加IM功能,实现亿级用户之间聊天.消息一出,IM(即时通讯)领域的大佬,同时也是个上线不到两岁的新生力量,再次引发了行业的关注. 对业内人士而言,即 ...

  4. Linux下SSH Session复制

    羡慕Windows下secureCRT的Session Copy功能,一直在寻找Linux下类似的软件,殊不知SSH本身就支持此功能. 特别感谢阿干同学的邮件分享. 详细方法 ? 1 2 3 4 Li ...

  5. JSP:JAVA Bean在JSP中的运用

    目录结构,如图: index.jsp <%@ page language="java" import="java.util.*" pageEncoding ...

  6. STL algorithm算法is_permutation(27)

    is_permutation原型: std::is_permutation equality (1) template <class ForwardIterator1, class Forwar ...

  7. JavaScript编程:java事件模型

    3.java事件模型: 传统事件处理程序指派方法:          1.var odiv=document.getElementById("div1");             ...

  8. 设计模式6:Composite

    Entry.java: package gendwang.cisco.com; public abstract class Entry { private int height = 0; privat ...

  9. hive udaf 用maven打包运行create temporary function 时报错

    用maven打包写好的jar,在放到hive中作暂时函数时报错. 错误信息例如以下: hive> create temporary function maxvalue as "com. ...

  10. Canny边缘检測算法原理及其VC实现具体解释(一)

    图象的边缘是指图象局部区域亮度变化显著的部分,该区域的灰度剖面一般能够看作是一个阶跃,既从一个灰度值在非常小的缓冲区域内急剧变化到还有一个灰度相差较大的灰度值.图象的边缘部分集中了图象的大部分信息,图 ...