Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155988 李昱龙 删除单词后缀 C++ Compile Error 0 MS 0 KB 347 2026-06-18 22:15:21

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ string w; cin>>w; int n=w.size(); for(int i=n-3;i<n;i++){ string g; g+=w[i]; if(g =="ling"){ g=g.substr(0,n-3); } if(g=="er"){ g=g.substr(0,n-2); } if(g=="ly"){ g=g.substr(0,n-2); } } cout<<g; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:20:8: error: 'g' was not declared in this scope
  cout<