import java.io.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class R455A {
FastScanner sc;
PrintWriter out;
String firstName;
String lastName;
public void solve() {
char[] a = sc.next().toCharArray();
char[] b = sc.next().toCharArray();
Arrays.sort(a);
Arrays.sort(b);
out.println(a[0] + "" + b[0]);
// out.println("hello");
//out.println(firstName.charAt(0) + "" + firstName.charAt(1) + "" + lastName.charAt(0));
}
private void run() {
//sc = new FastScanner(new File("input.txt"));
sc = new FastScanner(System.in);
out = new PrintWriter(System.out);
//int test = 1;
//for (int i=1; i<=test; i++) {
//System.out.println("test #" + i);
solve();
//System.out.println();
//}
out.close();
}
public static void main(String[] args) {
new R455A().run();
}
private class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(File f) {
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
FastScanner(InputStream f) {
br = new BufferedReader(new InputStreamReader(f));
}
String next() {
while (st == null || !st.hasMoreTokens()) {
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (s == null)
return null;
st = new StringTokenizer(s);
}
return st.nextToken();
}
boolean hasMoreTokens() {
while (st == null || !st.hasMoreTokens()) {
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (s == null)
return false;
st = new StringTokenizer(s);
}
return true;
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
}
}