一二三

你弟弟刚刚学会写英语的一(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. Eclipse中使用版本控制----Git

    之前在做软件开发的过程中使用的版本控制软件大多是cvs,svn等等,这些都属于cvcs,及中央版本控制系统,其特点是存在一个中央库,开发者首先从中央库中下载代码,编辑,然后提交.很明显的一个特点就是使 ...

  2. SEO分享:我为什么会有这么多的优质外链资源?

    前面小浪发了一篇文章" [完整版]我是怎样3个月把800指数的词做上首页的.",非常多人看了之后都表示非常佩服.顽强的运行力.确实SEO就是要顽强的运行力,也有人说吹牛吧,一天50 ...

  3. crm查询记录共享给了哪些人

    有时候,我们须要查询一个记录.共享给了哪些人?怎么做? 第一种做法:是sql的方式 select * from PrincipalObjectAccess where objectid = '5226 ...

  4. Swift - 单例模式的实现

    过去Swift要实现单例,无非是这三种方式:全局变量,内部变量和dispatch_once方式.但都略显繁琐. 后来从1.2版本起,Swift中添加了如 static let 和 static var ...

  5. 删除workspace下的vss的scc文件

    public class DeleteAA { public static void main(String[] args) { DeleteAA aa=new DeleteAA(); aa.dele ...

  6. Android ListView 之 SimpleAdapter 二 (包含 item 中按钮监听)

    1    MainActivity.java package com.myadapter; import java.util.ArrayList; import java.util.HashMap; ...

  7. Phalcon资源文件管理(Assets Management)

    资源文件管理(Assets Management)¶ Phalcon\Assets是一个让开发人员管理静态资源的组件,如管理css,javascript等. Phalcon\Assets\Manage ...

  8. 0 and 1

    Description Andrewid the Android is a galaxy-famous detective. In his free time he likes to think ab ...

  9. 2015 Multi-University Training Contest 8

    Hdu 5385 The path 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5385 题意:有一个联通的有向图,d(x)用来记录从1点到x点的最短 ...

  10. boost.asio包装类st_asio_wrapper开发教程(2014.5.23更新)(一)-----转

    一:什么是st_asio_wrapper它是一个c/s网络编程框架,基于对boost.asio的包装(最低在boost-1.49.0上调试过),目的是快速的构建一个c/s系统: 二:st_asio_w ...