九度OJ 1003

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>

bool judge(const char& ch)
{
    if(ch == ',')
        return true;
    else
        return false;
}
using namespace std;
int main()
{
    string num1, num2;
    while(cin >> num1 >> num2)
    {
        num1.erase(remove_if(num1.begin(), num1.end(), judge), num1.end());
        num2.erase(remove_if(num2.begin(), num2.end(), judge), num2.end());
        int a, b;
        istringstream is1(num1);
        is1 >> a;
        istringstream is2(num2);
        is2 >> b;
        cout << a + b << endl;
    }
    return 0;
}

你可能感兴趣的:(九度OJ 1003)