#include <bits/stdc++.h>
using namespace std;
const int maxN = 500 + 2;
int ch;
int add(string a, string b) {
  string res;
  int cur = 0;
  for (int i = 0; i < max(a.size(), b.size()); i++) {
    int tmp = 0;
    tmp += (i < a.size() ? a[i] - '0' : 0);
    tmp += (i < b.size() ? b[i] - '0' : 0);
    tmp += cur;
    cur = 0;
    if (tmp >= ch) tmp -= ch, cur = 1;
    res += char(tmp + '0');
  }
  if (cur) res += '1';
  return res.size();
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  char maxi = *max_element(a.begin(), a.end());
  maxi = max(maxi, *max_element(b.begin(), b.end()));
  ch = maxi - '0';
  ch++;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  cout << add(a, b) << endl;
  return 0;
}
