#include <bits/stdc++.h>
using namespace std;
int f[100], s[100];
int Sum(string a, string b, int ba) {
  for (int i = a.size() - 1; i > -1; i--) f[a.size() - 1 - i] = a[i] - '0';
  for (int i = b.size() - 1; i > -1; i--) f[b.size() - 1 - i] += b[i] - '0';
  for (int i = 0; i < 10; i++)
    if (f[i] > ba - 1) f[i + 1] += (f[i] / ba), f[i] %= ba;
  for (int i = 10; i > -1; i--)
    if (f[i] != 0) return i + 1;
}
int main() {
  string a, b;
  cin >> a >> b;
  int ba = -1;
  for (int i = 0; i < a.size(); i++) ba = max(ba, a[i] - '0' + 1);
  for (int i = 0; i < b.size(); i++) ba = max(ba, b[i] - '0' + 1);
  cout << Sum(a, b, ba) << endl;
}
