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