#include <bits/stdc++.h>
using namespace std;
int main(){
string a,b;
while (cin>>a>>b){
int min_pos=1e9,min_value=1e9;
for (int i=0;i<a.length();i++){
if (a[i]<min_value){
min_pos=i;
min_value=a[i];
}
}
for (int i=0;i<=min_pos;i++){
cout<<a[i];
}
cout<<b;
for (int i=min_pos+1;i<a.length();i++){
cout<<a[i];
}
cout<<endl;
}
return 0;
}