#include <bits/stdc++.h>
using namespace std;
int i, j, k, sm, mx, mn, res, n;
int a, b;
void read() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> a >> b;
}
void solve() {
  i = a;
  j = b;
  while (i) {
    mx = max(mx, i % 10);
    i /= 10;
  }
  while (j) {
    mx = max(mx, j % 10);
    j /= 10;
  }
  mx++;
  i = 0;
  while (a || b || k) {
    i *= 10;
    i += (a % 10 + b % 10 + k) % mx;
    k = (a % 10 + b % 10 + k) / mx;
    a /= 10;
    b /= 10;
    res++;
  }
  cout << res;
}
int main() {
  read();
  solve();
  return 0;
}
