Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
65511 | 王一涵(吃土豆长大的马铃薯) | 删除单词后缀 | C++ | 通过 | 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; }