#include <bits/stdc++.h>
using namespace std;
long long max1(long long a, long long b) {
  if (a < b) return b;
  return a;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int check(char c) {
  if (c == 'A' || c == 'a') return 1;
  if (c == 'E' || c == 'e') return 1;
  if (c == 'O' || c == 'o') return 1;
  if (c == 'U' || c == 'u') return 1;
  if (c == 'Y' || c == 'y') return 1;
  return 0;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;
  vector<int> v1, v2;
  int t1 = a, t2 = b;
  int m1 = -1;
  int m2 = -1;
  int i, j;
  while (t1) {
    if (t1 % 10 > m1) m1 = t1 % 10;
    v1.push_back(t1 % 10);
    t1 /= 10;
  }
  while (t2) {
    if (t2 % 10 > m2) m2 = t2 % 10;
    v2.push_back(t2 % 10);
    t2 /= 10;
  }
  int l1 = v1.size();
  int l2 = v2.size();
  if (l1 > l2) {
    while (l1 != l2) {
      v2.push_back(0);
      l2++;
    }
  } else if (l1 < l2) {
    while (l1 != l2) {
      v1.push_back(0);
      l1++;
    }
  }
  int mx = 0;
  for (i = max(m1, m2) + 1; i < 19; i++) {
    vector<int> v3;
    int cry = 0;
    for (j = 0; j < l1; j++) {
      int sum = (v1[j] + v2[j] + cry);
      v3.push_back(sum % i);
      if (sum / i > 0)
        cry = 1;
      else
        cry = 0;
    }
    if (cry == 1) v3.push_back(1);
    if (v3.size() > mx) mx = v3.size();
  }
  cout << mx << endl;
  return 0;
}
