#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s2;
  int max = 0, maxs = 0, ms, a[20], k = 0;
  cin >> s >> s2;
  for (int i = 0; i < 20; i++) {
    a[i] = 0;
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] - '0' > max) {
      max = s[i] - '0';
    }
  }
  for (int i = 0; i < s2.size(); i++) {
    if (s2[i] - '0' > max) {
      max = s2[i] - '0';
    }
  }
  max += 1;
  if (s.size() > s2.size()) {
    maxs = s.size();
    ms = s.size() - s2.size();
  } else {
    maxs = s2.size();
    ms = s2.size() - s.size();
  }
  for (int i = maxs - 1; i >= 0; i--) {
    if (s.size() > s2.size()) {
      if (i - ms >= 0) {
        a[k] += (s[i] - '0') + s2[i - ms] - '0';
        while (a[k] >= max) {
          a[k] -= max;
          a[k + 1]++;
        }
        k++;
      } else {
        a[k] += s[i] - '0';
        while (a[k] >= max) {
          a[k] -= max;
          a[k + 1]++;
        }
        k++;
      }
    } else {
      if (i - ms >= 0) {
        a[k] += (s[i - ms] - '0') + (s2[i] - '0');
        while (a[k] >= max) {
          a[k] -= max;
          a[k + 1]++;
        }
        k++;
      } else {
        a[k] += s2[i] - '0';
        while (a[k] >= max) {
          a[k] -= max;
          a[k + 1]++;
        }
        k++;
      }
    }
  }
  k = 0;
  for (int i = 0; i < 20; i++) {
    if (a[i] > 0) {
      k = i;
    }
  }
  cout << k + 1 << endl;
  return 0;
}
