水水更健康
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    string a;
    getline(cin, a);
    unsigned cnt = 0;
    for (auto const &i : a) {
        if (isdigit(i))
            ++cnt;
    }
    cout << cnt;
}
为什么错误呀
用getline处理,可能有空格,你这样输入中间就断了