张黄源 • 6个月前
#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; }
评论: