#include <bits/stdc++.h>
using namespace std;
char a[10], b[10];
void solve() {
  int i, j, k, lena, lenb, ans;
  i = 1;
  j = 0;
  while (a[j]) {
    if (a[j] - '0' > i) i = a[j] - '0';
    j++;
  }
  lena = j;
  j = 0;
  while (b[j]) {
    if (b[j] - '0' > i) i = b[j] - '0';
    j++;
  }
  lenb = j;
  i++;
  k = ans = 0;
  while (lena && lenb) {
    j = b[--lenb] - '0' + a[--lena] - '0' + k;
    k = j / i;
    ans++;
  }
  while (lena) {
    j = a[--lena] - '0' + k;
    k = j / i;
    ans++;
  }
  while (lenb) {
    j = b[--lenb] - '0' + k;
    k = j / i;
    ans++;
  }
  if (k) ans++;
  cout << ans << endl;
}
int main() {
  cin >> a >> b;
  solve();
  return 0;
}
