| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 152563 | 唐诗阳 | 删除单词后缀 | C++ | Compile Error | 0 MS | 0 KB | 673 | 2026-04-26 15:50:38 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ string s; cin>>s; int n=s.length() if(s[n-1]=='r' && s[n-2]=='e'){ for(int i=n-1;i>n-3;i--) s.erase(n-2,n) } else if(s[n-1]=='y' && s[n-2]=='l'){ for(int i=n-1;i>n-3;i--) s.erase(n-2,n) } else if(s[n-1]=='g' && s[n-2]=='n' && s[n-3]=='i'){ for(int i=n-1;i>n-4;i--) s.erase(n-3,n) } cout<<s; return 0; }
Main.cc: In function 'int main()':
Main.cc:10:5: error: expected ',' or ';' before 'if'
if(s[n-1]=='r' && s[n-2]=='e'){
^
Main.cc:14:5: error: 'else' without a previous 'if'
else if(s[n-1]=='y' && s[n-2]=='l'){
^
Main.cc:17:5: error: expected ';' before '}' token
}
^
Main.cc:21:5: error: expected ';' before '}' token
}
^