#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
map<int, char> b;
char n1[50], n2[50];
int s1[50], s2[50];
int r[50];
int l1, l2;
void init(void);
void getdata(void);
int main() {
  int i, j;
  int mmin, de;
  int ans;
  init();
  while (scanf(" %s %s", n1, n2) != EOF) {
    l1 = strlen(n1);
    l2 = strlen(n2);
    memset(r, 0, sizeof(r));
    memset(s1, 0, sizeof(s1));
    memset(s2, 0, sizeof(s2));
    mmin = 0;
    for (j = 0, i = l1 - 1; i >= 0; i--, j++) {
      s1[j] = m[n1[i]];
      if (s1[j] > mmin) mmin = s1[j];
    }
    for (j = 0, i = l2 - 1; i >= 0; i--, j++) {
      s2[j] = m[n2[i]];
      if (s2[j] > mmin) mmin = s2[j];
    }
    de = mmin + 1;
    for (i = 0; i < max(l1, l2); i++) {
      r[i] += (s1[i] + s2[i]);
      r[i + 1] += r[i] / de;
      r[i] %= de;
    }
    ans = 50;
    while (ans > 1 && r[ans - 1] == 0) ans--;
    printf("%d\n", ans);
  }
  return 0;
}
void init(void) {
  int i;
  for (i = 0; i < 10; i++) {
    m['0' + i] = i;
    b[i] = '0' + i;
  }
  for (i = 0; i < 26; i++) {
    m['A' + i] = 10 + i;
    b[10 + i] = 'A' + i;
  }
}
void getdata(void) {}
