#include <bits/stdc++.h>
using namespace std;
int p, suma, res;
string a, b;
void check(string s) {
  for (int i = 0; i < s.length(); i++) {
    int temp;
    if (s[i] >= '0' && s[i] <= '9')
      temp = s[i] - '0';
    else
      temp = s[i] - 'A' + 10;
    p = max(temp + 1, p);
  }
}
int sum(string s) {
  int q = 1;
  int ret = 0;
  for (int j = s.length() - 1; j >= 0; j--) {
    int temp;
    if (s[j] >= '0' && s[j] <= '9')
      temp = s[j] - '0';
    else
      temp = s[j] - 'A' + 10;
    ret += temp * q;
    q *= p;
  }
  return ret;
}
int main() {
  cin >> a >> b;
  p = 0;
  check(a);
  check(b);
  suma = sum(a) + sum(b);
  while (suma) {
    res++;
    suma /= p;
  }
  cout << res;
  return 0;
}
