一二三

你弟弟刚刚学会写英语的一(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. How to search a table in a store proc and open the store proc

    1. select*fromdba_dependencieswherereferenced_name='CNTL_ISSUE'andTYPE='PROCEDURE' 2. selecttextfrom ...

  2. 用lambda表达式声明委托

    首先来分享一段代码: Func<int, int, int> addMethod = (int x, int y) => (x + y); 熟悉的人肯定知道这句话是什么意思,可是不熟 ...

  3. 菜鸟级springmvc+spring+mybatis整合开发用户登录功能(下)

    昨天介绍了mybatis与spring的整合,今天我们完成剩下的springmvc的整合工作. 要整合springmvc首先得在web.xml中配置springmvc的前端控制器DispatcherS ...

  4. 史上最全的java随机数/字符串生成算法(转)

    代码如下: package com.zuidaima.core.util; import java.util.Random; public class RandomUtil { public stat ...

  5. Apache 服务器

    1.介绍 Apache原来用于小型或试验性Internet网络,后来逐步扩展到各种系统中,对Linux的支持几乎完美.Apache可以支持SSL技术,支持多台虚拟主机.Apache是以进程为基础的结构 ...

  6. Kendo UI开发教程(24): 单页面应用(二) Router 类

    Route类负责跟踪应用的当前状态和支持在应用的不同状态之间切换.Route通过Url的片段功能(#url)和流量器的浏览历史功能融合在一起.从而可以支持把应用的某个状态作为书签添加到浏览器中.Rou ...

  7. Android开发:在onTouchEvent中处理任意时间的长按事件

    Android提供了GestureDetector类来处理一些常用的手势操作,比如说 onLongPress,onFling 等.但这里不使用GestureDetector,而是直接在自定义View重 ...

  8. [置顶] android之Notification版本兼容性问题

    首先先来创建一个notification提示 //概要 String tickerText = context.getResources().getText(R.string.app_name).to ...

  9. Linux下经常使用的shell命令记录

    硬件篇 CPU相关 lscpu #查看的是cpu的统计信息. cat /proc/cpuinfo #查看CPU信息具体信息,如每一个CPU的型号,主频等 内存相关 free -m #概要查看内存情况 ...

  10. Delphi 获取网站验证码的图片

    uses ActiveX,ComObj; procedure TfrmMain.FormCreate(Sender: TObject); begin OleInitialize(nil); end; ...