Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138500 王丞杰 删除单词后缀 C++ Accepted 1 MS 276 KB 538 2025-11-25 17:02:35

Tests(10/10):


Code:

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