Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152710 任艺宸 删除单词后缀 C++ Runtime Error 2 MS 344 KB 582 2026-05-01 17:20:19

Tests(2/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ string s; getline(cin,s); int n=s.size(); if(s[n-1]=='r'&&s[n-2]=='e'){ s.erase(s[n]-2,2); }else if(s[n-1]=='y'&&s[n-2]=='l'){ s.erase(n-2,2); }else if(s[n-1]=='g'&&s[n-2]=='n'&&s[n-3]=='i'){ s.erase(n-3,3); }cout<<s<<endl; return 0; }


Run Info:

terminate called after throwing an instance of '