Description

There are n words, you have to turn them into plural form.

If a singular noun ends with ch, x, s, o, then the plural is -es. For example, witch -> witches, tomato -> tomatoes.

If a singular noun ends with f or fe, then the plural is -ves. For example, leaf -> leaves, knife -> knives. Note that f becomes v.

The noun ending with y will become -ies. For example, family -> families.

All other singular nouns are added with s. For example, book -> books.

Input

The first line, a number n, represents the number of words.

Next n lines, each line represents a word.

The number of words <= 10000, 1 <= word length <= 100.

Output

N lines.

Output the words in plural form.

Sample Input

3
contest
hero
lady

Sample Output

contests
heroes
ladies 题意:模拟题,水题,注意f,fe这块就行了。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
const int maxn=;
int n;
string s;
int main()
{
scanf("%d",&n);
while(n--)
{
cin>>s;
int len=s.length();
if(s[len-]=='x'||s[len-]=='s'||s[len-]=='o'||(s[len-]=='h'&&s[len-]=='c'))
{
cout<<s<<"es"<<endl;
}
else if(s[len-]=='y')
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ies"<<endl;
}
else if(s[len-]=='f')
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ves"<<endl;
}
else if((s[len-]=='e'&&s[len-]=='f'))
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ves"<<endl;
}
else
cout<<s<<"s"<<endl;
}
return ;
} /**********************************************************************
Problem: 2216
User: therang
Language: C++
Result: AC
Time:420 ms
Memory:2024 kb
**********************************************************************/

最新文章

  1. CentOS如何查看硬盘品牌型号等具体信息
  2. [LeetCode]444. Sequence Reconstruction
  3. jqzoom与scrollpic配合的问题
  4. php的memcache和memcached扩展区别
  5. Json数据与Json数据转换
  6. String之“==”与equals
  7. MySQL functions, IF, CASE
  8. Python基础:函数
  9. 系统启动时,spring配置文件解析失败,报”cvc-elt.1: 找不到元素 &#39;beans&#39; 的声明“异常
  10. poj 3635(bfs+优先队列)
  11. BitSet
  12. ZOJ 3430 Detect the Virus 【AC自动机+解码】
  13. android ellipsize 属性详解
  14. 解决ios双击页面上移问题
  15. Android图片裁剪之自由裁剪
  16. AlphaBlend參数BLENDFUNCTION
  17. 用Linux命令行实现删除和复制指定类型的文件
  18. 【WebService】WebService学习笔记
  19. poptest老李谈分布式与集群 2
  20. UrlRewriter配置IIS支持伪静态

热门文章

  1. Orchard 相关
  2. 洛谷 P3952 时间复杂度【模拟】
  3. poj 3243 Clever Y &amp;&amp; 1467: Pku3243 clever Y【扩展BSGS】
  4. bzoj 1180: [CROATIAN2009]OTOCI【LCT】
  5. 【原创】《从0开始学Elasticsearch》—集群健康和索引管理
  6. hdu 1044 Collect More Jewels
  7. 题解报告:poj 2533 Longest Ordered Subsequence(最长上升子序列LIS)
  8. 题解报告:poj 3320 Jessica&#39;s Reading Problem(尺取法)
  9. IOS利用Core Text对文字进行排版 - 转
  10. [转]强制取消TFS2008中其它成员的签出文件