Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
119690 | 李昊宇 | 删除单词后缀 | C++ | Wrong Answer | 0 MS | 272 KB | 394 | 2025-05-18 14:56:03 |
#include<bits/stdc++.h> using namespace std; string a; int main(){ string k,m,j,n; cin>>a; int len=a.size(); if(len>1){ k=a.substr(len-2,len-1); } else if(len>2){ j=a.substr(len-3,len-1); } if(len>2&&k=="ly"||len>2&&k=="er"){ a=a.erase(len-2,2); } else if(len>3&&j=="ing"){ a=a.erase(len-3,3); } cout<<a<<endl; return 0; }
------Input------
lying
------Answer-----
ly
------Your output-----
lying