#include <bits/stdc++.h>
using namespace std;
int mn, n, m, tmp, a[1000], b[1000], c[1000], maxx;
int main() {
  scanf("%d%d", &n, &m);
  maxx = 0;
  mn = 0;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  a[0] = b[0] = c[0] = 0;
  tmp = n;
  while (tmp > 0) {
    a[++a[0]] = tmp % 10;
    if (tmp % 10 > mn) mn = tmp % 10;
    tmp /= 10;
  }
  tmp = m;
  while (tmp > 0) {
    b[++b[0]] = tmp % 10;
    if (tmp % 10 > mn) mn = tmp % 10;
    tmp /= 10;
  }
  memset(c, 0, sizeof(c));
  c[0] = max(a[0], b[0]);
  for (int i = 1; i <= c[0]; i++) c[i] = a[i] + b[i];
  int k = 0;
  for (int i = mn + 1; i <= 16; i++) {
    k = i;
    for (int j = 1; j <= c[0]; j++)
      if (c[j] >= k) {
        c[j] -= k;
        c[j + 1]++;
      }
    if (c[c[0] + 1] > 0) c[0]++;
    if (c[0] > maxx) maxx = c[0];
    memset(c, 0, sizeof(c));
    c[0] = max(a[0], b[0]);
    for (int j = 1; j <= c[0]; j++) c[j] = a[j] + b[j];
  }
  printf("%d\n", maxx);
  return 0;
}
