Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
329835 黄浙峰老师 【C5-4】删除单词后缀 C++ 通过 100 2 MS 256 KB 344 2025-07-08 14:12:27

Tests(4/4):


#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int l=s.size(); for(int i=0;i<l-1;i++){ if(s[l-1]=='r'&&s[l-2]=='e'){ s.erase(l-2,2); }else if(s[l-1]=='y'&&s[l-2]=='l'){ s.erase(l-2,2); }else if(s[l-1]=='g'&&s[l-2]=='n'&&s[l-3]=='i'){ s.erase(l-3,3); } } cout<<s; return 0; }


测评信息: