#55598: c++解答


yp11451009@yphs.tp.edu.tw (711-19王敬皓)


#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    // 逐行讀取輸入的字串,直到檔案結束 (EOF)
    while (getline(cin, s)) {
        stringstream ss(s); // 將該行字串轉換為字串流
        long long int x, ans = 0; // x 用來存提取出來的數字,ans 用來累加總和
        
        // 依序從字串流中提取整數
        while (ss >> x) {
            ans += x;
        }
        
        // 輸出該行所有數字的加總結果
        cout << ans << endl;
    }
    return 0;
}