#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b, c, d, p, q, ans = 0, mx = 0, res = 0;
  cin >> a >> b;
  c = a, d = b;
  while (c) {
    mx = max(mx, c % 10);
    c /= 10;
  }
  while (d) {
    mx = max(mx, d % 10);
    d /= 10;
  }
  mx++;
  while ((a > 0) || (b > 0)) {
    p = a % 10;
    q = b % 10;
    res = (p + q + res) / mx;
    ans++;
    a /= 10;
    b /= 10;
  }
  if (res > 0) ans++;
  cout << ans;
}
