#include <stdio.h>
#include <stdlib.h>
int main() {
	int x, y, *p, n=1, i;
	scanf("%d", &x);
	scanf("%d", &y);
	p=(int*)malloc(sizeof(int)*n);
	while(x != 0 || y != 0){
		if(x == 0 || y == 0){
			break;
		}
		int l = x % 10;
		x /= 10;
		int m = y % 10;
		y /= 10;
		if(m == l){
			p[n-1] = m;
			n++;
			p=(int*)realloc(p,sizeof(int)*(n-1));
			p[n-1] = l;
		}
		else if(m > l){
			p[n-1] = m;
		}
		else{
			p[n-1] = l;
		}
		n++;
		p=(int*)realloc(p,sizeof(int)*(n-1));
	}
	if(x != 0){
		while(x != 0){
			if(x == 0){
				break;
			}
			int l = x % 10;
			x /= 10;
			p[n-1] = l;
			n++;
			if(x == 0){
				break;
			}
			p=(int*)realloc(p,sizeof(int)*(n-1));
		}
	}
	else if(y != 0){
		while(y != 0){
			if(y == 0){
				break;
			}
			int l = y % 10;
			y /= 10;
			p[n-1] = l;
			n++;
			if(y == 0){
				break;
			}
			p=(int*)realloc(p,sizeof(int)*(n-1));
		}
	}
	for(i=n-2;i>=0;i--){
		printf("%d", p[i]);
	}
	
	free(p);
	return 0;
}