#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  int w;
  cin >> a >> b;
  w = a.size();
  for (int i = 1; i < a.size(); ++i)
    if (a[i] >= b[0]) {
      w = i;
      break;
    }
  for (int i = 0; i < w; ++i) cout << a[i];
  cout << b[0];
  return 0;
}
