#include <bits/stdc++.h>
int main() {
  int a, b, n, count = 0, max, m;
  scanf("%d%d", &a, &b);
  n = a;
  max = n % 10;
  n /= 10;
  while (n > 0) {
    if (max < n % 10) max = n % 10;
    n /= 10;
  }
  n = b;
  while (n > 0) {
    if (max < n % 10) max = n % 10;
    n /= 10;
  }
  n = 0;
  while (a > 0 && b > 0) {
    n = n + a % 10 + b % 10;
    if (n > max)
      n = 1;
    else
      n = 0;
    count++;
    a /= 10;
    b /= 10;
  }
  while (a > 0) {
    n = n + a % 10;
    if (n > max)
      n = 1;
    else
      n = 0;
    count++;
    a /= 10;
  }
  while (b > 0) {
    n = n + b % 10;
    if (n > max)
      n = 1;
    else
      n = 0;
    count++;
    b /= 10;
  }
  if (n == 1) count++;
  printf("%d", count);
}
