#include <bits/stdc++.h>
using namespace std;
bool cnt(string a, string b) {
  if (a.length() == b.length()) {
    int i;
    for (i = 0; i < a.length(); i++) {
      if (a[i] < b[i]) return 1;
      if (a[i] > b[i]) return 0;
    }
    return 0;
  } else {
    if (a.length() < b.length()) return 1;
    return 0;
  }
}
int main() {
  string a, b;
  int pos, i, c;
  cin >> a >> b;
  for (i = 0, pos = 0; i < a.length(); i++) pos = max(pos, a[i] - '0' + 1);
  for (i = 0; i < b.length(); i++) pos = max(pos, b[i] - '0' + 1);
  if (cnt(a, b)) swap(a, b);
  for (i = 0, c = 0; i < a.length() - 1; i++)
    c = 10 * c + (pos - (a[i] - '0') - 1);
  c = 10 * c + (pos - (a[i] - '0'));
  stringstream ss;
  ss << c;
  string str;
  ss >> str;
  if (cnt(str, b) || str == b)
    cout << a.length() + 1;
  else
    cout << a.length();
  return 0;
}
