一二三 湖南第七届省赛

A - 一二三
Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu
Submit
 
Status
Description
你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?  
Input
第一行为单词的个数(不超过10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。 
Output
对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。 

Sample Input
3
owe
too
theee
Sample Output
1
2
3

AC代码:

#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
 int n;
 scanf("%d",&n);
 while(n--)
 {
  char a[6];
  int ans=0;
  scanf("%s",a);
  if(strlen(a)==3)
  {
   if((a[0]=='o'&&a[1]=='n')|| (a[0]=='o'&&a[2]=='e')||(a[1]=='n'&&a[2]=='e')) ans=1;
   else  ans=2;
  }
  else  ans=3;
  printf("%d
",ans);
 }
 return 0;
}
原文地址:https://www.cnblogs.com/www-cnxcy-com/p/5761598.html