1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;

void dodaj(string a, string b) {
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    int reminder = 0;
    vector<int> v;
    for(int i=0;i<max(a.size(), b.size()); i++) {
        int d1 = 0;
        int d2 = 0;
        if(i < a.size()) d1 = a[i]-'0';
        if(i < b.size()) d2 = b[i]-'0';
        int sum = d1 + d2 + reminder;
        v.push_back(sum % 10);
        reminder = sum / 10;
    }
    if(reminder > 0) {
        v.push_back(reminder);
    }
    for(int i=v.size()-1;i>=0;i--) {
        cout<<v[i];
    }
}

int main() {
    string a,b;
    cin>>a>>b;
    dodaj(a,b);
    return 0;
}