Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
98482 任斌 删除单词后缀 C++ Compile Error 0 MS 0 KB 347 2024-11-23 09:43:47

Tests(0/0):


Code:

V#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int l=s.length(); if(l>2 && (s[l-1]=='r' && s[l-2]=='e')) { s.erase(l-2,2); } if(l>2 && (s[l-1]=='y' && s[l-2]=='l')) s.erase(l-2,2); if(l>2 && (s[l-1]=='g' && s[l-2]=='n' && s[l-3]=='i')) s.erase(l-2,3); cout<<s; return 0; }


Run Info:

Main.cc:1:2: error: stray '#' in program
 V#include
  ^
Main.cc:1:1: error: 'V' does not name a type
 V#include
 ^
Main.cc: In function 'int main()':
Main.cc:5:2: error: 'string' was not declared in this scope
  string s;
  ^
Main.cc:6:2: error: 'cin' was not declared in this scope
  cin>>s;
  ^
Main.cc:6:7: error: 's' was not declared in this scope
  cin>>s;
       ^
Main.cc:16:2: error: 'cout' was not declared in this scope
  cout<