B1016.部分A+B(15)
#include <cstdio>
#include <cstring>
int calc(long long a, long long da) {
int aa = 0;
while(a != 0) {
if(a % 10 == da){
aa = aa * 10 + da;
}
a /= 10;
}
return aa;
}
int main() {
long long a, b, da, db;
int pa, pb;
scanf("%lld%lld%lld%lld", &a, &da, &b, &db);
pa = calc(a, da);
//printf("%d-----
", pa);
pb = calc(b, db);
//printf("%d-----
", pb);
int sum = pa + pb;
printf("%d
", sum);
return 0;
}