#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  char ans[20];
  char cmp = b[0];
  ans[0] = a[0];
  int i = 1;
  while (true) {
    if (a[i] >= cmp || i == (a.length())) {
      ans[i] = cmp;
      break;
    }
    ans[i] = a[i];
    ++i;
  }
  for (int j = 0; j <= i; ++j) cout << ans[j];
}
