#include <bits/stdc++.h>
int IntMaxVal = (int)1e20;
long long LongMaxVal = (long long)1e20;
template <typename T>
struct argument_type;
template <typename T, typename U>
struct argument_type<T(U)> {};
using namespace std;
istream& operator>>(istream& is, pair<int, int>& s) {
  is >> s.first >> s.second;
  return is;
}
int main() {
  ios_base::sync_with_stdio(false);
  int a;
  cin >> a;
  ;
  int b;
  cin >> b;
  ;
  int base = 0;
  int tmp = a;
  while (tmp > 0) {
    { base = max(base, tmp % 10); };
    tmp /= 10;
  }
  tmp = b;
  while (tmp > 0) {
    { base = max(base, tmp % 10); };
    tmp /= 10;
  }
  base++;
  int digs = 0;
  while (a > 0 || b > 0) {
    digs++;
    int x = a % 10 + b % 10;
    if (x >= base) a += 10;
    a /= 10;
    b /= 10;
  }
  cout << digs;
}
