#include <bits/stdc++.h>
using namespace std;
long long po(int x, int y) {
  int f = 1;
  for (int i = 0; i < y; i++) f *= x;
  return f;
}
int base(string x) {
  set<int> s;
  set<int>::reverse_iterator it = s.rbegin();
  int a;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] < 48 || x[i] > 57)
      s.insert(tolower(x[i]) - 87);
    else
      s.insert(x[i] - '0');
  }
  return *it;
}
int sum(string x, int a) {
  int y = 0;
  for (int i = x.size() - 1, j = 0; i >= 0; i--, j++) {
    if (x[i] >= 48 && x[i] <= 57)
      y += (x[i] - '0') * po(a, j);
    else
      y += (tolower(x[i]) - 87) * po(a, j);
  }
  return y;
}
int ret(int x, int a) {
  int b;
  string y;
  while (x > 0) {
    b = x % a;
    if (b > 9)
      y += b + 87;
    else
      y += b + '0';
    x /= a;
  }
  return y.size();
}
int main() {
  int a, b, c, d;
  string x, y;
  cin >> x >> y;
  a = base(x) + 1;
  b = base(y) + 1;
  if (b > a) a = b;
  c = sum(x, a);
  d = sum(y, a);
  c += d;
  if (b > a) a = b;
  cout << ret(c, a);
  return 0;
}
