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
32
33
34
35
#include<iostream>
#include<string>
using namespace std;
string dodawanie(string a, string b)
{
    int pa = a.length() - 1;
    int pb = b.length() - 1;
    string wyn = "";
    int p = 0;
    while(pa >= 0 || pb >= 0)
    {
        int ca, cb, w;
        if(pa >= 0) ca = a[pa] - 48;
        else ca = 0;
        if(pb >= 0) cb = b[pb] - 48;
        else cb = 0;
        w = ca + cb + p;
        wyn = "0" + wyn;
        wyn[0] = 48 + w % 10;
        p = w / 10;
        pa--;
        pb--;
    }
    if(p) wyn = "1" + wyn;
    return wyn;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a;
    cin>>b;
    cout<<dodawanie(a,b);

}