Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
65511 | 王一涵(吃土豆长大的马铃薯) | 删除单词后缀 | C++ | Accepted | 0 MS | 252 KB | 603 | 2025-05-22 16:47:50 |
#include <iostream> #include <string> using namespace std; int main() { string word; cin >> word; if (word.length() >= 3 && word.substr(word.length() - 3) == "ing") { word = word.substr(0, word.length() - 3); } else if (word.length() >= 2 && word.substr(word.length() - 2) == "ly") { word = word.substr(0, word.length() - 2); } else if (word.length() >= 2 && word.substr(word.length() - 2) == "er") { word = word.substr(0, word.length() - 2); } cout << word << endl; return 0; }