你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?
标签:
对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。
3
owe
too
theee
1
2
3
AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int T;
char a[5];
//freopen("data/1010.txt","r",stdin);
cin>>T;
while(T--)
{
cin>>a;
int len = strlen(a);
if(len==5)
cout<<"3"<<endl;
else if(a[0]=='o')
{
if(a[1]=='w'&&a[2]=='o')
cout<<"2"<<endl;
else
cout<<"1"<<endl;
}
else
{
if(a[1]=='n'&&a[2]=='e')
cout<<"1"<<endl;
else
cout<<"2"<<endl;
}
}
return 0;
}
标签:
原文地址:http://blog.csdn.net/hurmishine/article/details/52219893