#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a = n, b = m;
  int maxnum = 0;
  while (a > 0) {
    maxnum = max(maxnum, a % 10);
    a /= 10;
  }
  while (b > 0) {
    maxnum = max(maxnum, b % 10);
    b /= 10;
  }
  maxnum++;
  int output = 0, rem = 0;
  while (n > 0 || m > 0 || rem > 0) {
    if (n % 10 + m % 10 + rem < maxnum) {
      output++;
      rem = 0;
    } else {
      output++, rem = (n % 10 + m % 10 + rem) / maxnum;
    }
    n /= 10;
    m /= 10;
  }
  cout << output << endl;
}
