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
#include <iostream>
#include <string>
using namespace std;
string A,B,C;
int a,b,c;
int main(){
    cin>>A>>B>>C;
    int n=A.size();
    long long w=0;
    
    for(int p=0;p<n;p++){
        int d=0;
        for(int l=p;l>=0;l--){
            a=A[l]-'0';
            b=B[l]-'0';
            c=C[l]-'0';
            int sum=a+b+d;
            if(sum%10!=c){
                break;}
            d=sum/10;
            if(d==0){
                w++;
            }}}
    cout<<w;
    return 0;
}