#28565: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

School : 臺北市立和平高級中學
ID : 163096
IP address : [203.72.60.244]
Last Login :
2022-03-11 16:00:13
d098. Stringstream運用練習(C++) -- 說明文件出自C++ Reference | From: [203.72.60.237] | Post Date : 2021-12-17 14:50

#include <iostream>
#include <sstream>
using namespace std;

int main(){
string s;
while (getline(cin, s)){
stringstream ss(s);
int sum=0;
string y;
while (ss >> y){
stringstream sy(y);
int x;
while (sy >> x){
stringstream sx;
sx << x;
if (y==sx.str()){
sum+=x;
}
}
}
cout << sum <<endl;
}
}
 
ZeroJudge Forum