#include <bits/stdc++.h>
using namespace std;
int main() {
  int q = 0, w = 0, e = 0;
  string s1, s2, s3, s4;
  cin >> s1 >> s2;
  q = s1.length();
  for (int i = s1.length() - 1; i >= 1; i--) {
    if (s1[i] >= s2[0]) {
      w = 1;
      q = i;
    }
  }
  for (int i = 0; i <= max(q - 1, 0); i++) cout << s1[i];
  cout << s2[0];
}
