#include <bits/stdc++.h>
using namespace std;
string a, b;
int main() {
  cin >> a >> b;
  int maxval = 0;
  ;
  for (int i = 0; i < (int)a.length(); i++) {
    maxval = max(maxval, a[i] - '0');
  }
  for (int i = 0; i < (int)b.length(); i++) {
    maxval = max(maxval, b[i] - '0');
  }
  int cnt = 0;
  maxval++;
  int j = b.length() - 1, A, B;
  int i = a.length() - 1;
  int next = 0;
  while (i >= 0 || j >= 0) {
    if (i < 0) {
      A = 0;
    } else {
      A = a[i] - '0';
    }
    if (j < 0) {
      B = 0;
    } else {
      B = b[j] - '0';
    }
    cnt++;
    if ((A + B + next) >= maxval) {
      next = 1;
    } else {
      next = 0;
    }
    i--;
    j--;
  }
  if (next == 1) {
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
