# 题目

3862767 6 13530293 3

399

3862767 1 13530293 8

0

# 源代码

//C/C++实现
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>

using namespace std;

int main(){
char a[11], b[11];
char da, db;
int count1 = 0, count2 = 0;
int sum1 = 0, sum2 = 0;
scanf("%s %c %s %c", a, &da, b, &db);
for(int i = 0; i < strlen(a); i++){
if(a[i] == da){
count1++;
}
}
for(int j = 0; j < count1; j++){
sum1 += (int)(da - '0') * pow((double)10, j);
}
for(int i = 0; i < strlen(b); i++){
if(b[i] == db){
count2++;
}
}
for(int j = 0; j < count2; j++){
sum2 += (int)(db - '0') * pow((double)10, j);
}
printf("%d\n", sum1 + sum2);
return 0;
}


//Java实现
import java.util.Scanner;
public class Main {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long a = scanner.nextLong();
int da = scanner.nextInt();
long b = scanner.nextLong();
int db = scanner.nextInt();
if(a > 0 && a < 10e10 && b > 0 && b < 10e10 && da >= 0 && da <10 && db >=0 && db < 10) {
String sa = String.valueOf(a);
char[] ca = sa.toCharArray();
char cda = (char)(da+48);
String sb = String.valueOf(b);
char[] cb = sb.toCharArray();
char cdb = (char)(db+48);
int pa = 0 , pb = 0 , count_da = 0 , count_db = 0;
for(int i=0;i<sa.length();i++)
{
if(ca[i] == cda)
{
count_da++;
}
}
for(int j=0;j<sb.length();j++){
if(cb[j] == cdb)
{
count_db++;
}
}
for(int k=0;k<count_da;k++){
pa += (da * Math.pow(10,k));
}
for(int l=0;l<count_db;l++){
pb += (db * Math.pow(10,l));
}
System.out.println(pa + pb);
}
}
}