题目:
输入样例 1:
3862767 6 13530293 3
输出样例 1:
399
输入样例 2:
3862767 1 13530293 8
输出样例 2:
0
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a = 0, b = 0, da = 0, db = 0;
string A, B;
cin >> A >> da >> B >> db;
for (int i = 0; i < A.size(); ++i) {
if (A[i] - '0' == da) a = a * 10 + da;
}
for (int i = 0; i < B.size(); ++i) {
if (B[i] - '0' == db) b = b * 10 + db;
}
cout << a + b;
return 0;
}