#include <iostream>

using namespace std;

int main(){
	long long x, y, rezbr=0;
	cin>>x>>y;
	long long max;
	long long min; 
	if(x>y){
		min=y;
		max=x;
	}if(y>x){
		max=y;
		min=x;
	}
	long long p=1;
	while(max!=0){
		int c1=max%10;
		max/=10;
		if(min!=0){
			int c2=min%10;
			min/=10;
			if(c1>c2){
				rezbr=rezbr+c1*p;
			}else if(c1<c2){
				rezbr=rezbr+c2*p;
			}else{
				rezbr=rezbr+(c1*p + c2*p*10);
				p=p*10;
			}
		}else{
			rezbr+=c1*p;
		}
	p=p*10;
	}
	cout << rezbr << endl;
}