#include <bits/stdc++.h>
using namespace std;
int a, b, Start_base = 0, ANS = -1;
void Make_start(int x) {
  while (x) {
    Start_base = max(Start_base, (x % 10) + 1);
    x /= 10;
  }
}
int Solve(int x, int y, int base) {
  int R, L = 0, C = 0;
  while (x || y || C) {
    R = C;
    if (x) R += (x % 10), x /= 10;
    if (y) R += (y % 10), y /= 10;
    C = R / base;
    L++;
  }
  return L;
}
int main() {
  cin >> a >> b;
  Make_start(a);
  Make_start(b);
  for (; Start_base <= 16; Start_base++)
    ANS = max(ANS, Solve(a, b, Start_base));
  cout << ANS << endl;
  return 0;
}
