Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
38157 | jiabokai | 删除单词后缀 | C++ | Accepted | 1 MS | 248 KB | 348 | 2024-01-25 14:57:33 |
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int i,l; char s[34]; int main() { cin>>s; l=strlen(s); if(l>2){ if(strcmp(&s[l-2],"er")==0||strcmp(&s[l-2],"ly")==0){ s[l-2]='\0'; } } if(l>3){ if(strcmp(&s[l-3],"ing")==0){ s[l-3]='\0'; } } cout<<s; return 0; }