#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ss;
  cin >> s >> ss;
  int n = 0, m = 0;
  int hval = -1;
  int x = n;
  map<char, int> mp;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= '0' && s[i] <= '9') {
      hval = max(hval, s[i] - '0');
    } else {
      mp[s[i]]++;
    }
  }
  for (int i = 0; i < ss.size(); i++) {
    if (ss[i] >= '0' && ss[i] <= '9') {
      hval = max(hval, ss[i] - '0');
    } else {
      mp[ss[i]]++;
    }
  }
  if (mp['A']) {
    hval = 11;
    mp['A'] = 11;
  }
  if (mp['B']) {
    hval = 12;
    mp['B'] = 12;
  }
  if (mp['C']) {
    hval = 13;
    mp['C'] = 13;
  }
  if (mp['D']) {
    hval = 14;
    mp['D'] = 14;
  }
  if (mp['E']) {
    hval = 15;
    mp['E'] = 15;
  }
  if (mp['F']) {
    hval = 16;
    mp['F'] = 16;
  }
  if (hval < 10) {
    hval++;
  }
  mp['1'] = 1;
  mp['2'] = 2;
  mp['3'] = 3;
  mp['4'] = 4;
  mp['5'] = 5;
  mp['6'] = 6;
  mp['7'] = 7;
  mp['8'] = 8;
  mp['9'] = 9;
  int h = hval;
  int p = 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    n += (mp[s[i]] * p);
    p *= h;
  }
  p = 1;
  for (int i = ss.size() - 1; i >= 0; i--) {
    n += (mp[ss[i]] * p);
    p *= h;
  }
  n = m + n;
  int cn = 0;
  while (n) {
    n /= hval;
    cn++;
  }
  cout << cn << endl;
}
