#include <bits/stdc++.h>
using namespace std;
int cal(int a, int b, int ba) {
  int x[100], xl, y[100], yl, i, z[100];
  memset(x, 0, sizeof x);
  memset(y, 0, sizeof y);
  memset(z, 0, sizeof z);
  xl = yl = 0;
  while (a > 0) {
    x[xl++] = a % 10;
    a /= 10;
  }
  while (b > 0) {
    y[yl++] = b % 10;
    b /= 10;
  }
  for (i = 0; i < max(xl, yl); i++) {
    z[i] += x[i] + y[i];
    if (z[i] >= ba) {
      z[i + 1] += z[i] / ba;
      z[i] %= ba;
    }
  }
  i = max(xl, yl) + 10;
  while (z[i] == 0) i--;
  return i + 1;
}
int main() {
  int a, b, i, t, m, ans;
  while (scanf("%d %d", &a, &b) != EOF) {
    m = 0;
    t = a;
    while (t > 0) {
      if (t % 10 > m) m = t % 10;
      t /= 10;
    }
    t = b;
    while (t > 0) {
      if (t % 10 > m) m = t % 10;
      t /= 10;
    }
    ans = 0;
    for (i = m + 1; i <= 1000; i++) {
      t = cal(a, b, i);
      if (t > ans) ans = t;
    }
    printf("%d\n", ans);
  }
  return 0;
}
