#include <bits/stdc++.h>
using namespace std;
string a, b;
int k = 0;
int toDec(string src, int base) {
  int cnt = 1, res = 0;
  for (int i = src.size() - 1; i >= 0; i--) {
    if (src[i] >= '0' && src[i] <= '9')
      res += ((int)src[i] - 48) * cnt;
    else
      res += ((int)src[i] - 55) * cnt;
    cnt *= base;
  }
  return res;
}
string decToBase(int src, int base) {
  string res = "";
  while (src > 0) {
    if (src % base < 10)
      res += (char)(src % base + 48);
    else
      res += (char)(src % base + 65);
    src /= base;
  }
  return res;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) a[i] = toupper(a[i]);
  for (int i = 0; i < b.size(); i++) b[i] = toupper(b[i]);
  for (int i = 0; i < a.size(); i++) k = max((int)a[i], k);
  for (int i = 0; i < b.size(); i++) k = max((int)b[i], k);
  if (k < 65)
    k -= 48;
  else
    k -= 65;
  int c = toDec(a, k + 1) + toDec(b, k + 1);
  cout << decToBase(c, k + 1).size() << endl;
  return 0;
}
