You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
655 B
27 lines
655 B
#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;
|
|
}
|