Files
python/TangDou/XiTi/1100.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

27 lines
655 B
C++

#include <bits/stdc++.h>
using namespace std;
bool has_suffix(const string &str, const string &suffix) {
return str.size() >= suffix.size() &&
str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
}
int main() {
string s;
cin >> s;
string replaceStr[3] = {"er", "ly", "ing"};
bool found = false;
for (int i = 0; i < 3; i++) {
if (has_suffix(s, replaceStr[i])) {
cout << s.substr(0, s.length() - replaceStr[i].length()) << endl;
found = true;
break;
}
}
if (!found) {
cout << s << endl;
}
return 0;
}