評分結果(參考) : AC (1ms, 328KB)
#include<bits/stdc++.h>
#define int long long
using namespace std;
int s2i(string& s){
int res = 0;
for(char c : s){
if(c<'0' || c>'9') return 0;
res = 10*res + (c-'0');
}
return res;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
string line;
while(getline(cin, line)){
stringstream ss(line);
int sum = 0;
string s;
while(ss >> s){
sum += s2i(s);
}
cout << sum << "\n";
}
return 0;
}