#include <bits/stdc++.h>
using namespace std;
char s1[1005], s2[1005];
char maxc;
int quan;
int solve(char *a, char *b, int jin) {
  char c[1006];
  int xx = 0;
  int i, j;
  for (i = strlen(a), j = strlen(b); i >= 0 && j >= 0; i--, j--) {
    int tmp = xx + a[i] - '0' + b[j] - '0';
    if (tmp >= jin)
      xx = 1;
    else
      xx = 0;
  }
  if (i >= 0) {
    for (; i >= 0; i--) {
      int tmp = xx + a[i] - '0';
      if (tmp >= jin)
        xx = 1;
      else
        xx = 0;
    }
    if (xx == 1)
      return strlen(a) + 1;
    else
      return strlen(a);
  } else {
    for (; j >= 0; j--) {
      int tmp = xx + b[j] - '0';
      if (tmp >= jin)
        xx = 1;
      else
        xx = 0;
    }
    if (xx == 1)
      return strlen(b) + 1;
    else
      return strlen(b);
  }
}
int main() {
  scanf("%s%s", s1, s2);
  maxc = '0';
  for (int i = 0; i < strlen(s1); i++)
    if (s1[i] > maxc) maxc = s1[i];
  for (int i = 0; i < strlen(s2); i++)
    if (s2[i] > maxc) maxc = s2[i];
  quan = maxc - '0' + 1;
  int res = solve(s1, s2, quan);
  printf("%d\n", res);
  return 0;
}
