Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
62667 王佰辉 删除单词后缀 C++ Compile Error 0 MS 0 KB 330 2023-12-24 17:22:37

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ string a; cin>>a; int lenn = a.length(); if(a[lenn - 1]=='e'&&a[len - 1]=='r'){ a.erase(len - 2,2); } if(a[len - 2]=='l'&&a[len - 1]=='y'){ a.erase(len - 2,2); } if(a[lenn - 3]=='i'&&a[lenn - 2]=='g'){ a.erase(lenn - 3,3); cout<<a; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:25: error: 'len' was not declared in this scope
  if(a[lenn - 1]=='e'&&a[len - 1]=='r'){
                         ^
Main.cc:10:8: error: 'len' was not declared in this scope
   if(a[len - 2]=='l'&&a[len - 1]=='y'){
        ^