#include<bits/stdc++.h>
using namespace std;
int main() {
string c;
cin>>c;
int b=c.size();
if(c[b-1]=='r'&&c[b-2]=='e') {
for(int i=0; i<=b-3; i++) {
cout<<c[i];
}
}
else if(c[b-1]=='y'&&c[b-2]=='l') {
for(int i=0; i<=b-3; i++) {
cout<<c[i];
}
}
else if(c[b-1]=='g'&&c[b-2]=='n'&&c[b-3]=='i') {
for(int i=0; i<=b-4; i++) {
cout<<c[i];
}
} else {
cout<<c;
}
return 0;
}
说明给定一个单词,如果该单词以er、ly或者ing后缀结尾, 则删除该后缀(题目保证删除后缀后的单词长度不为0), 否则不进行任何操作。
最新推荐文章于 2024-09-14 22:25:23 发布