#include <bits/stdc++.h>
using namespace std;
int base, Max = 0, cnt = 0;
string s, k;
void calc() {
  cnt = 0;
  int ln = s.size() - 1;
  int ln1 = k.size() - 1;
  int carry = 0;
  for (; ln != -1 && ln1 != -1;) {
    int p = s[ln] - '0';
    int q = k[ln1] - '0';
    ln--;
    ln1--;
    if (p + q + carry >= base) {
      carry = 1;
      cnt++;
    } else {
      carry = 0;
      cnt++;
    }
  }
  if (ln == -1 && ln1 == -1) {
    if (carry) cnt++;
  } else if (ln != -1) {
    for (int i = ln; i >= 0; i--) {
      int p = s[i] - '0';
      if (p + carry >= base) {
        carry = 1;
        cnt++;
      } else {
        carry = 0;
        cnt++;
      }
    }
    if (carry) cnt++;
  } else {
    for (int i = ln1; i >= 0; i--) {
      int p = k[i] - '0';
      if (p + carry >= base) {
        carry = 1;
        cnt++;
      } else {
        carry = 0;
        cnt++;
      }
    }
    if (carry) cnt++;
  }
  Max = max(cnt, Max);
}
int main() {
  cin >> s;
  cin >> k;
  int p = 0;
  for (int i = 0; i < s.size(); i++) {
    p = max(p, (s[i] - '0'));
  }
  for (int i = 0; i < k.size(); i++) {
    p = max(p, (k[i] - '0'));
  }
  for (int i = 18; i > p; i--) {
    base = i;
    calc();
  }
  cout << Max << endl;
}
