提交时间:2025-07-08 13:19:34
运行 ID: 329800
#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; }