0
已解决
李素妍
新手天翼
新手天翼
找错
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
char k;
int n;
cin>>n;
for(int i=1;i<=n;i++) {
cin>>s>>k;
if(k=='v') cout<<s<<endl;
else{
int y=s[s.size()-1];
if(s[y]=='s'||s[y]=='z'||s[y]=='x'||(s[y]=='h'&&s[y-1]=='c')||(s[y]=='h'&&s[y-1]=='s'))cout<<s<<"es"<<endl;
else if(s[y]=='y'){
s[y]='i';
cout<<s<<"es"<<endl;
}
else cout<<s<<"s"<<endl;
}
}
return 0;
}
0
已采纳
张天璨
新手天翼
新手天翼
很简单,代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,l;
char a;
string b;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>b>>a;
if(a!='n')
{
cout<<b<<endl;
continue;
}
l=b.size();
if(b[l-1]=='s'||b[l-1]=='z'||b[l-1]=='x'||b[l-1]=='h'&&b[l-2]=='c'||b[l-1]=='h'&&b[l-2]=='s')
cout<<b<<"es"<<endl;
else if(b[l-1]=='y')
{
b[l-1]='i';
cout<<b<<"es"<<endl;
}
else
cout<<b<<"s"<<endl;
}
return 0;
}
0