#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INF = 1 << 28;
const long long INFL = 1LL << 62;
using namespace std;
int mx = 0;
void getMD(int n) {
  for (; n; n /= 10) mx = max(mx, n % 10);
}
int getLen(int x, int y, int base) {
  int l = 0, c = 0, r;
  while (x || y || c) {
    r = c;
    if (x) r += x % 10, x /= 10;
    if (y) r += y % 10, y /= 10;
    l++;
    c = r / base;
  }
  return l;
}
int main() {
  int x, y;
  cin >> x >> y;
  getMD(y);
  getMD(x);
  int len = -1;
  for (int i = mx + 1; i <= 16; ++i) {
    len = max(len, getLen(x, y, i));
  }
  cout << len << endl;
}
