#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int a, b;
  cin >> a >> b;
  int mx = 0;
  for (int i : {a, b})
    for (int j = i; j; j /= 10) mx = max(mx, j % 10);
  int len = 0, x = 0;
  while (a || b || x) {
    int sum = a % 10 + b % 10 + x;
    x = (sum > mx), a /= 10, b /= 10, len++;
  }
  cout << len << endl;
  return 0;
}
