#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s1, s2, sum = "";
  cin >> s >> s1;
  s2 += s;
  s2 += s1;
  int ch = 0;
  char c = '0';
  for (int i = 0; i < s2.size(); i++)
    if (s2[i] > c) c = s2[i];
  ch = c - 48;
  ch++;
  reverse(s.begin(), s.end());
  reverse(s1.begin(), s1.end());
  if (s.size() >= s1.size()) {
    int n = 0;
    for (int i = 0; i < s.size(); i++) {
      int x;
      if (i < s1.size()) {
        x = (s[i] - 48) + (s1[i] - 48) + n;
        char ch2 = (x % ch) + 48;
        sum += ch2;
        n = x / ch;
      } else {
        char ch1 = (s[i] + n);
        if ((ch1 - 48) >= ch) {
          sum += '0';
          n = ((ch1 - 48) / ch);
        } else {
          sum += (s[i] + n);
          n = 0;
        }
      }
    }
    if (n != 0)
      cout << sum.size() + 1 << '\n';
    else
      cout << sum.size() << '\n';
  } else {
    int n = 0;
    for (int i = 0; i < s1.size(); i++) {
      int x;
      if (i < s.size()) {
        x = (s[i] - 48) + (s1[i] - 48) + n;
        char ch2 = (x % ch) + 48;
        sum += ch2;
        n = x / ch;
      } else {
        char ch1 = (s1[i] + n);
        if ((ch1 - 48) >= ch) {
          sum += '0';
          n = ((ch1 - 48) / ch);
        } else {
          sum += (s1[i] + n);
          n = 0;
        }
      }
    }
    if (n != 0)
      cout << sum.size() + 1 << '\n';
    else
      cout << sum.size() << '\n';
  }
  return 0;
}
