Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
156934 赵奕杰 统计数字字符个数 C++ Wrong Answer 1 MS 272 KB 433 2026-07-11 15:30:10

Tests(0/10):


Code:

#include <iostream> #include <string> using namespace std; int main() { string str; // 读取一行字符(包含空格) getline(cin, str); int count = 0; // 遍历字符串,统计数字字符 for (char c : str) { if (c >= '0' && c <= '9') { count++; } } cout << "数字字符的个数为:" << count << endl; return 0; }


Run Info:

------Input------
I have seen 3 persons over there.
------Answer-----
1
------Your output-----
数字字符的个数为:1