#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, base, arr[10000], j = 0;
  cin >> n >> m;
  string s, t;
  stringstream ss, tt;
  ss << n;
  ss >> s;
  tt << m;
  tt >> t;
  s += t;
  sort(s.begin(), s.end());
  base = s[s.size() - 1] - '0';
  base = base + 1;
  while (n != 0 || m != 0) {
    if (n % 10 + m % 10 >= base)
      arr[j] = n % 10 + m % 10 - base, n /= 10, m /= 10, n++;
    else
      arr[j] = n % 10 + m % 10, n /= 10, m /= 10;
    j++;
  }
  cout << j;
  return 0;
}
