#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int main() {
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int mx = 0;
  for (int i = 0; i < (int)(((int)s.size())); i++) mx = max(mx, s[i] - '0');
  for (int i = 0; i < (int)(((int)t.size())); i++) mx = max(mx, t[i] - '0');
  ++mx;
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  int rem = 0, ans = 0;
  for (int i = 0; i < max(((int)t.size()), ((int)s.size())); i++) {
    int val0 = 0, val1 = 0;
    if (i < ((int)t.size())) val0 = t[i] - '0';
    if (i < ((int)s.size())) val1 = s[i] - '0';
    if (val0 + val1 + rem >= mx)
      rem = 1;
    else
      rem = 0;
    ans++;
  }
  if (rem != 0) ans++;
  cout << ans << endl;
  return 0;
}
