Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
119689 毛靖平 删除单词后缀 C++ Runtime Error 2 MS 348 KB 460 2025-05-18 14:53:41

Tests(1/10):


Code:

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int main(){ string s1,s2,s3,s4; cin>>s1; int len=s1.size(); s2=s1.substr(len-3,len-1); s3=s1.substr(len-2,len-1); if(s3=="ly"&&len>2){ cout<<s1.erase(len-2,2); } else if(s3=="er"&&len>2){ cout<<s1.erase(len-2,2); } else if(s2=="ing"&&len>3){ cout<<s1.erase(len-3,3); } return 0; }


Run Info:

terminate called after throwing an instance of '