Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
88964 sh25_zhangyj 数单词 C++ 通过 0 MS 248 KB 578 2026-05-22 14:31:34

Tests(1/1):


#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string s; getline(cin, s); // 读取整行输入(含空格、标点) string target = "lanqiao"; int count = 0; // 先把整个字符串转为小写 for (char &ch : s) { ch = tolower(ch); } // 滑动窗口统计 int len = target.size(); for (int i = 0; i <= (int)s.size() - len; i++) { if (s.substr(i, len) == target) { count++; } } cout << count << endl; return 0; }


测评信息: