#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int pos = 0;
int res[10];
int main() {
  memset(res, -1, sizeof(res));
  char astr[7], bstr[7];
  scanf("%s%s", astr, bstr);
  int L1 = (int)strlen(astr), L2 = (int)strlen(bstr), a = 0, b = 0;
  for (int i = 0; i < L1; i++) {
    if (astr[i] - '0' > pos) pos = astr[i] - '0';
  }
  for (int i = 0; i < L2; i++) {
    if (bstr[i] - '0' > pos) pos = bstr[i] - '0';
  }
  pos++;
  if (L2 > L1) {
    char temp[7];
    for (int i = 0; i < 7; i++) temp[i] = astr[i];
    for (int i = 0; i < 7; i++) astr[i] = bstr[i];
    for (int i = 0; i < 7; i++) bstr[i] = temp[i];
    swap(L1, L2);
  }
  int c = 0;
  int j = L2 - 1;
  for (int i = L1 - 1; i >= 0; i--) {
    if (j < 0) {
      res[i] = c + astr[i] - '0' + 0;
      c = res[i] / pos;
      res[i] = res[i] % pos;
    } else {
      res[i] = c + astr[i] - '0' + bstr[j] - '0';
      c = res[i] / pos;
      res[i] = res[i] % pos;
      j--;
    }
  }
  int k = 0;
  if (c != 0) k++;
  for (int i = 0; i < 10; i++)
    if (res[i] != -1) k++;
  printf("%d", k);
  return 0;
}
