Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
98483 | 任斌 | 删除单词后缀 | C++ | Accepted | 1 MS | 276 KB | 346 | 2024-11-23 09:44:17 |
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int l=s.length(); if(l>2 && (s[l-1]=='r' && s[l-2]=='e')) { s.erase(l-2,2); } if(l>2 && (s[l-1]=='y' && s[l-2]=='l')) s.erase(l-2,2); if(l>2 && (s[l-1]=='g' && s[l-2]=='n' && s[l-3]=='i')) s.erase(l-3,3); cout<<s; return 0; }