#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
int mx(int n) {
  int m = 0;
  while (n) {
    m = max(m, n % 10);
    n /= 10;
  }
  return m;
}
int pro(int n, int m, int base) {
  int ans = 0, c = 0;
  while (n || m || c) {
    c += n % 10 + m % 10;
    c = (c >= base) ? 1 : 0;
    ans++;
    n /= 10;
    m /= 10;
  }
  return ans;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  int base = max(mx(n), mx(m)) + 1;
  cout << pro(n, m, base) << "\n";
  return 0;
}
