比较无脑的方法
#include <iostream>
#include <cctype>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    char c;
    int letters = 0, digits = 0, others = 0;

    while (cin.get(c)) {          // 逐字符读取(包括空格、换行等)
        if (c == '?') break;      // 遇到 '?' 停止,且不统计它

        if (isalpha(c)) {
            letters++;
        } else if (isdigit(c)) {
            digits++;
        } else {
            others++;
        }
    }

    cout << "Letters=" << letters << '\n';
    cout << "Digits=" << digits << '\n';
    cout << "Others=" << others << '\n';

    return 0;
}