一二三
描述
你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?
时间限制:1000 ms | 内存限制:65535 KB
难度:1
输入
第一行为单词的个数(不超过 10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。
输出
对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。
样例输入
3 owe too theee
样例输出
1 2 3
来源
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<set>
#include<algorithm>//sort
#include<string>
#include<string.h>
#include <memory.h>
using namespace std;
int main()
{
int b;
scanf("%d",&b);
while(b--)
{
string a;
cin>>a;
if(a.length() >3)//根据长度判three
{
cout<<3;
}
else
{
if((a[0]=='o'&&a[1]=='n')||(a[0]=='o'&&a[2]=='e')||(a[1]=='n'&&a[2]=='e'))//根据特征判断one
{
cout<<1;
}
else
{
cout<<2;
}
}
cout<<endl;//恭喜发财!
}
return 0;
}
384

被折叠的 条评论
为什么被折叠?



