Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
360 邓小龙 删除单词后缀 C++ Runtime Error 1 MS 328 KB 482 2022-08-12 16:40:59

Tests(0/10):


Code:

#include <cstring> #include <iostream> using namespace std; int main() { string a; //,aer="er",aly="ly",aing="ing",aend; cin>>a; int b=a.size(); string c=a.substr(b-2,2),d=a.substr(b-3,3);//substr(a,b)a是指开始位置 if(c[0]=='e'&&c[1]=='r') { a.erase(b-2,2); } if(c[0]=='l'&&c[1]=='y') { a.erase(b-2,2); } if(d[0]=='i'&&d[1]=='n'&&d[2]=='g') { a.erase(b-3,3); } if(a.size()>0) cout<<a<<endl; return 0; }


Run Info:

terminate called after throwing an instance of '