邹金行 • 13天前
#include <iostream> #include <string> using namespace std; int main() { string word; cin >> word; if (word.size() >= 3 && word.substr(word.size() - 3) == "ing") { word.erase(word.size() - 3); } else if (word.size() >= 2 && word.substr(word.size() - 2) == "er") { word.erase(word.size() - 2); } else if (word.size() >= 2 && word.substr(word.size() - 2) == "ly") { word.erase(word.size() - 2); } cout << word << endl; return 0; }
评论: