#include <bits/stdc++.h>
using namespace std;
int convert(int a, int init) {
  int res = 0;
  for (int i = 0; a > 0; i++) {
    int val = (a % 10);
    res += val * pow(init, i);
    a /= 10;
  }
  return res;
}
string to_base(unsigned int n, unsigned int base) {
  const char alphabet[] = "0123456789ABCDEFGHI";
  string result;
  while (n) {
    result += alphabet[n % base];
    n /= base;
  }
  reverse(result.begin(), result.end());
  return result;
}
bool check(int a, int base) {
  string str = to_string(a);
  bool res = true;
  for (auto elem : str) {
    if (elem >= '0' + base) {
      res = false;
      break;
    }
  }
  return res;
}
int main() {
  int a, b;
  cin >> a >> b;
  int res2 = 0;
  for (int i = 2; i <= 18; i++) {
    if (check(a, i) && check(b, i)) {
      int res = convert(a, i) + convert(b, i);
      int len = to_base(res, i).length();
      res2 = max(res2, len);
    }
  }
  cout << res2 << endl;
  return 0;
}
