#include <bits/stdc++.h>
using namespace std;
int a, b;
int get_max_dig(int a, int b) {
  int d = 0;
  while (a > 0) {
    d = ((a % 10) > (d) ? (a % 10) : (d));
    a /= 10;
  }
  while (b > 0) {
    d = ((b % 10) > (d) ? (b % 10) : (d));
    b /= 10;
  }
  return d;
}
int count_dig(int sol) {
  int cont = 0;
  while (sol > 0) {
    cont++;
    sol /= 10;
  }
  return cont;
}
int main() {
  cin >> a >> b;
  int bas = get_max_dig(a, b) + 1;
  int c = ((a) > (b) ? (a) : (b));
  int l = 1;
  int sol = 0;
  int ac = 0;
  int count = 0;
  while (l <= c) {
    int dig = (a % 10) + (b % 10) + ac;
    sol = sol + (dig % bas) * l;
    count++;
    if (dig >= bas) {
      ac = 1;
    } else {
      ac = 0;
    }
    a /= 10;
    b /= 10;
    l *= 10;
  }
  if (ac == 1) {
    count++;
  }
  cout << count << '\n';
  return 0;
}
