| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 136458 | 刘益梵 | 删除单词后缀 | C++ | Compile Error | 0 MS | 0 KB | 470 | 2025-11-15 08:09:46 |
#include <iostream> #include <string> std::string processWord(const std::string& word) { // 检查前缀是否为 "re-", "dis-" 或 "ab-" if (word.substr(0, 3) == "re-" || word.substr(0, 3) == "dis" || word.substr(0, 3) == "ab-") { return word.substr(3); } else { return word; } int main() { std::string word; std::cin >> word; std::cout << processWord(word) << std::endl; return 0; }
Main.cc: In function 'std::__cxx11::string processWord(const string&)':
Main.cc:12:5: error: a function-definition is not allowed here before '{' token
{
^
Main.cc:16:5: error: expected '}' at end of input
}
^