62怎么错了?

lixinyan 爱因斯坦 2024-04-07 19:08:36 10

#include <bits/stdc++.h>

using namespace std;

int main() {

int n = 0;

string a;

getline(cin, a);

for (int i = 0; i <= a.size(); i++) {
    if (a[i] != ' ')
        n++;
}

cout << n;

return 0;

}

{{ vote && vote.total.up }}

共 1 条回复

root 站长

i <= a.size() 错了