#include <bits/stdc++.h>
using namespace std;
string a, b, c;
int p, d;
int z(char y) {
  if (y >= 'A' && y <= 'Z') return y - 'A' + 10;
  return y - '0';
}
int main() {
  cin >> a >> b;
  if (a.size() < b.size()) swap(a, b);
  int d = z(max(*max_element(a.begin(), a.end()),
                *max_element(b.begin(), b.end()))) +
          1;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  for (int i = 0; i < a.size(); i++) {
    if (i < b.size())
      p = (p + z(a[i]) + z(b[i])) / d;
    else
      p = (p + z(a[i])) / d;
  }
  cout << a.size() + p;
  return 0;
}
