#include <bits/stdc++.h>
using namespace std;
int getMD(int n) {
  int mx = 0;
  while (n) {
    mx = max(mx, n % 10);
    n /= 10;
  }
  return mx;
}
int getlength(int a, int b, int base) {
  int rem = 0;
  int c = 0;
  int l = 0;
  while (a || b || c) {
    rem = c;
    if (a) rem += a % 10;
    a /= 10;
    if (b) rem += b % 10;
    b /= 10;
    l++;
    c = rem / base;
  }
  return l;
}
int main() {
  int a, b;
  cin >> a >> b;
  int start = max(getMD(a), getMD(b));
  int res = -1;
  for (int i = start + 1; i <= 16; i++) {
    res = max(res, getlength(a, b, i));
  }
  cout << res;
  return 0;
}
