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
**********************************************************************/

CSU 2018年12月月赛 D 2216 : Words Transformation的更多相关文章

  1. CSU 2018年12月月赛 B 2214: Sequence Magic

    Description 有一个1到N的自然数序列1,2,3,...,N-1,N. 我们对它进行M次操作,每次操作将其中连续的一段区间 [Ai,Bi][Ai,Bi] (即第Ai个元素到第Bi个元素之间的 ...

  2. CSU 2018年12月月赛 H(2220): Godsend

    Description Leha somehow found an array consisting of n integers. Looking at it, he came up with a t ...

  3. CSU 2018年12月月赛 G(2219): Coin

    Description 有这样一个众所周知的问题: 你面前有7个硬币,其中有一个劣质的(它比正常的硬币轻一点点),你有一个天平,问需要你需要使用天平多少次能保证找到那个劣质的硬币. 众所周知的算法是: ...

  4. CSU 2018年12月月赛 F(2218): Finding prime numbers

    Description xrdog has a number set. There are 95 numbers in this set. They all have something in com ...

  5. CSU 2018年12月月赛 A 2213: Physics Exam

    Description 高中物理老师总认为给学生文本形式的问题比给纯计算形式的问题要求更高.毕竟,学生首先得阅读和理解问题. 因此,他们描述一个问题不像”U=10V,I=5A,P=?”,而是”有一个含 ...

  6. 2018年12月8日广州.NET微软技术俱乐部活动总结

    吕毅写了一篇活动总结,写得很好!原文地址是:https://blog.walterlv.com/post/december-event-microsoft-technology-salon.html ...

  7. [2018-11-27]2018年12月1日宁波dotnet社区线下活动

    离上次活动,转眼又过了一个月,幸得各路大神支持,于本周六(12月1日),宁波dotnet社区的线下分享活动又来啦! 活动嘉宾及主题 董斌辉 2015-2019年微软全球最有价值专家(.NET方向) 2 ...

  8. CodePlus2017 12月月赛 div2可做题2

    11月的月赛错过了,来打12月月赛,由于很(zi)想(ji)拿(tai)衣(ruo)服(la),所以去打div2. T1是一个sb模拟,但是机房全卡死在这道语文题上了,基本上弄了一个半小时,T2可以秒 ...

  9. web前端开发2018年12月找工作总结

    2018年的冬天额外的冷,由内致外... 作为一名刚刚踏入社会的实习生,可谓是狠狠的体验了一把什么叫社会(同时也感叹父母赚钱真的很不容易) 前几天看见这样一句话"如果你不知道社会的辛苦,要么 ...

随机推荐

  1. jquery操作ID带有变量的节点

    var indexNode='content'+index;$("#"+indexNode).show( 'puff', { }, 500, callback );

  2. 洛谷 P4012 深海机器人问题 【最大费用最大流】

    和火星那个有点像,但是这个价值直接在路径上,不用拆点,对于每条价值为w的边(i,j),连接(i,j,1,w)(i,j,inf,0),表示价值只能取一次,然后连接源点和所有出发点(s,i,k,0),所有 ...

  3. (8)css表格

    用css设置表格样式 *<table></table> 标签定义 HTML 表格. * tr 元素定义表格的行:th 元素定义表格的表头:td 元素定义表格中的单元格:capt ...

  4. IE6 position:fixed bug hack方式

    /* IE6浏览器的特有方法 */ /* 修正IE6振动bug */ * html,* html body{background-image:url(about:blank);background-a ...

  5. 数据结构 - 链队列的实行(C语言)

    数据结构-链队列的实现 1 链队列的定义 队列的链式存储结构,其实就是线性表的单链表,只不过它只能尾进头出而已, 我们把它简称为链队列.为了操作上的方便,我们将队头指针指向链队列的头结点,而队尾指针指 ...

  6. _bzoj1013 [JSOI2008]球形空间产生器sphere【高斯消元】

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1013 保存高斯消元模版. ps,这一题的英文名字是ヨスガノソラ的开发商~^_^ #inclu ...

  7. 菜鸡CodeFoces打卡单

    2017.12.13 1:05 签到3题 Educational Codeforces Round 34 (Rated for Div. 2) 补题:

  8. 12c pdb expdp use DATA_PUMP_DIR meet ORA-39145

    ORA-39002: invalid operation ORA-39070: Unable to open the log file. ORA-39087: directory name DATA_ ...

  9. 【Hibernate】Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

    今天用hibernate框架写crm项目时遇到报错: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' n ...

  10. 微信小程序组件解读和分析:七、button按钮

    button按钮组件说明: button,顾名思义,按钮,类似于html的button标签.我们可以设置按钮的属性,比如字体颜色大小,背景颜色等,可以给按钮绑定事件,用户点击时会触发事件. butto ...