Vasya studies positional numeral systems. Unfortunately, he often forgets to write the base of notation in which the expression is written. Once he saw a note in his notebook saying a + b = ?, and that the base of the positional notation wasn’t written anywhere. Now Vasya has to choose a base p and regard the expression as written in the base p positional notation. Vasya understood that he can get different results with different bases, and some bases are even invalid. For example, expression 78 + 87 in the base 16 positional notation is equal to FF16, in the base 15 positional notation it is equal to 11015, in the base 10 one — to 16510, in the base 9 one — to 1769, and in the base 8 or lesser-based positional notations the expression is invalid as all the numbers should be strictly less than the positional notation base. Vasya got interested in what is the length of the longest possible expression value. Help him to find this length.The length of a number should be understood as the number of numeric characters in it. For example, the length of the longest answer for 78 + 87 = ? is 3. It is calculated like that in the base 15 (11015), base 10 (16510), base 9 (1769) positional notations, for example, and in some other ones.

The first letter contains two space-separated numbers a and b (1 ≤ a, b ≤ 1000) which represent the given summands.

Print a single number — the length of the longest answer.

if __name__ == '__main__':
	a, b = raw_input().split(" ")
	base = 0
	for digit in a:
		base = max(base, int(digit))
	for digit in b:
		base = max(base, int(digit))
	base += 1
	a10 = int(a, base)
	b10 = int(b, base)
	sum = a10 + b10
	res = 0
	while sum > 0:
		res += 1
		sum /= base
	print res

# -*- coding: UTF-8 -*-

# from itertools import *
# from collections import defaultdict
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    return ((num == 0) and  "0" ) or ( baseN(num // b, b).lstrip("0") + numerals[num % b])
T = raw_input().split()

base = int(max(T[0]+T[1]))+1
sum_max = int(T[0], base) + int(T[1], base)
print len(str(baseN(sum_max, base)))

text = raw_input()

a, b = text.split()

ans = 0
mm = int(max(a + b))

for x in range(mm + 1, 25):
  v = int(a, x) + int(b, x)
  cnt = 0
  while v > 0:
    cnt += 1
    v /= x
  ans = max(ans, cnt)

print ans

buf = raw_input()
d = int(max(buf)) + 1
s = sum(int(x,d) for x in buf.split())
c = 1
while s / d != 0:
    s /= d
    c += 1
print c

a, b = [int(i) for i in raw_input().split()]

maxdigit = max([ord(i) for i in str(a)] + [ord(i) for i in str(b)])
maxdigit = int(chr(maxdigit))

osn = maxdigit + 1

sm = int(str(a), osn) + int(str(b), osn)

cnt = 1
while osn ** cnt <= sm:
    cnt += 1
print cnt

#!/usr/bin/env python
alpha = '0123456789ABCDEF'
def to_base(num, base):
    global alpha
    m = int(max(num))
    num = int(num)
    res = ''
    while num >0:
        res+=alpha[num % base]
        num/=base
    return res

a, b = raw_input().split(' ')
res = 0
s = int(max(int(max(a)), int(max(b))))+1
for i in range(s, 17):
    res = max(res, len(to_base(str(int(a, i)+int(b,i)),i)[::-1]))
print res

a, b = raw_input ().split ()
p = max (map (int, a + b)) + 1
s = int (a, p) + int (b, p)
ans = 0
while s > 0:
    ans += 1
    s /= p
print ans

__author__ = 'MoustaphaSaad'
line = raw_input().split()
base = 0

def cal(n):
    res = 0
    while n > 0:
        res = max(res, n % 10)
        n /= 10
    return res
a, b = int(line[0]), int(line[1])
base = max(base, cal(a)+1)
base = max(base, cal(b)+1)
car, lene= 0, 0
while a != 0 or b != 0:
    tmp = a % 10 + b % 10 + car
    car = tmp / base
    a /= 10
    b /= 10
    lene += 1
if car > 0:
    lene += 1

print lene

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def test_len(n1, n2, base):
    if len(n1) > len(n2):
        s = map(int, n1)
        n = n2
    else:
        s = map(int, n2)
        n = n1
    s.insert(0, 0)
    for i in xrange(len(n)):
        s[-i-1] += int(n[-i-1])
    for i in xrange(1, len(s)+1):
        while s[-i] >= base:
            s[-i-1] += 1
            s[-i] -= base
    if s[0] == 0:
        s.pop(0)
    return len(s)

def main():
    a, b = raw_input().split()
    mbase = max([int(s) for s in a + b])
    print max([test_len(a, b, base) for base in xrange(16, mbase, -1)])
    return 0

if __name__ == '__main__':
    main()

s = raw_input()
a,b = map(int,s.split())
m = int(max(list(s.replace(' ','')))) + 1
res = int(str(a),m) + int(str(b),m)
ans = 0
while res > 0:
    res //= m
    ans += 1
print(ans)

#!/usr/bin/env python

a,b = map(str, raw_input().split(' '))

A = []
B = []
for i in a:
    A.append(int(i))

for i in b:
    B.append(int(i))

A.reverse()
B.reverse()

maxlen = max(len(A),len(B))

for i in range(len(A),maxlen+1):
    A.append(0)

for i in range(len(B),maxlen+1):
    B.append(0)

base = max(max(A),max(B))+1

C = []

for i in range(maxlen+1):
    s = A[i]+B[i]
    C.append(s%base)
    reste = s/base
    if reste > 0:
        A[i+1] += 1

for i in range(len(C),0,-1):
    if C[i-1] != 0:
        print i
        quit()

s = raw_input()
sys = int(max(s)) + 1
a1, a2 = s.split()
c = int(a1, sys) + int(a2, sys)
count = 1
while c / sys != 0:
    c = c / sys
    count += 1
print count

a, b = raw_input().split()
x = int(max(a + b)) + 1
s = int(a, x) + int(b, x)
ans = 0
while s:
    ans += 1
    s /= x
print ans

from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:from __builtin__ import xrange as range;from future_builtins import ascii, filter, hex, map, oct, zip

BUFSIZE = 8192;
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n");ii = lambda: int(input());ll = lambda: list(map(int , input().split()));vv = lambda: map(int , input().split());pr = print
pl = lambda l: pr(" ".join(list(map(str,l))))

a , b = vv()
A , B = a , b
a = list(map(int , str(a)))
b = list(map(int , str(b)))
base = max(max(a) , max(b)) + 1
dec = int(str(A),base)+ int(str(B) , base)
ans = []
while(dec!=0):
    ans.append(dec%base)
    dec//=base
print(len(ans))

from sys import stdin

def decTo(x, d):
  s = ''
  while x > 0:
    z = x % d
    s += str(z)
    x //= d
  return int(s[::-1])

def toDec(x, d):
  s = 0
  count = 0
  while x > 0:
    z = x % 10 * pow(d, count)
    count += 1
    s += z
    x //= 10
  return s

a, b = next(stdin).split()
max1 = max(a)
max1 = int(max(b)) if max(b) > max1 else int(max1)
max1 += 1
print(len(str(decTo(toDec(int(a), max1) + toDec(int(b), max1), max1))))

def s():
	[a,b] = input().split()
	m = int(max(max(a),max(b)))+1
	a = int(a)
	b = int(b)
	c = 0
	r = 0
	while a or b or c:
		r += 1
		c = (a%10+b%10+c)//m
		a//=10
		b//=10
	print(r)
s()

#Code by Sounak, IIESTS
#------------------------------warmup----------------------------

import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------game starts now-----------------------------------------------------
a,b=list(map(int,input().split()))
k=int(max(str(a)+str(b)))+1
carry=0
l=max(len(str(a)),len(str(b)))
for itr in range(l):
    if a%10+b%10+carry<k: carry=0
    else: carry=1
    a//=10
    b//=10
    #print(a,b)
if carry: print(l+1)
else: print(l)

sa, sb = input().strip().split()

base = max(int(c) for c in sa + sb) + 1

a = int(sa); b = int(sb)

ans = 0; prev = 0
while a + b + prev:
    prev = (a % 10 + b % 10 + prev) // base
    a //= 10; b //= 10
    ans += 1

print(ans)

import sys
from array import array  # noqa: F401

def input():
    return sys.stdin.buffer.readline().decode('utf-8')

a, b = input().split()
base = max(max(map(int, a)), max(map(int, b))) + 1
ans = 0
rem = 0
a, b = int(a), int(b)
while a or b or rem:
    ans += 1
    rem += (a % 10) + (b % 10)
    a, b = a // 10, b // 10
    rem //= base

print(ans)

import math

def add_base(a, b, base):
    # print(base)
    a = int(a, base = base)
    b = int(b, base = base)
    # print("a",a)
    # print("b",b)
    res = a + b
    # print("res",res)
    nu = ''
    while res:
        nu = str(res % base) + nu
        res = math.floor(res / base)
    # print("nu", nu)
    return len(nu)

def main():
    a, b = input().split()
    st = str(a) + str(b)
    max_ord = 0
    for i in st:
        if max_ord < (ord(i) - 48):
            max_ord = (ord(i) - 48)
    base = max_ord + 1
    ans = add_base(a, b, base)
    print(ans)

if __name__ == '__main__':
    main()

def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

class CodeforcesTask49BSolution:
    def __init__(self):
        self.result = ''
        self.expression = []

    def read_input(self):
        self.expression = [int(x) for x in input().split(" ")]

    def process_task(self):
        nums = str(self.expression[0]) + str(self.expression[1])
        base = max([int(c) for c in nums]) + 1
        num1 = int(str(self.expression[0]), base)
        num2 = int(str(self.expression[1]), base)
        self.result = str(len(baseN(num1 + num2, base)))

    def get_result(self):
        return self.result

if __name__ == "__main__":
    Solution = CodeforcesTask49BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

a, b = map(int, input().split())
m = 0
for i in str(a):
    m = max(m, int(i))
for i in str(b):
    m = max(m, int(i))
m += 1

f = 0
s = 0
t = 1
for i in str(a)[::-1]:
    f += int(i) * t
    t *= m
t = 1
for i in str(b)[::-1]:
    s += int(i) * t
    t *= m

fin = f + s
t = 1
ans = 0
while t * m <= fin:
    ans += 1
    t *= m

print(ans + 1)

from collections import *

letters = '0123456789ABCDEF'

def todecimal(s, base):
    res = 0
    for i in range(len(s)):
        res = (res * base) + letters.find(s[i])
    return res

def tobase(s, base):
    res = deque([])
    if s == 0:
        return 0
    while (s != 0):
        res.appendleft(letters[s % base])
        s //= base
    return ''.join(res)

a, b = map(int, input().split())
ma = max(int(max(list(str(a)))), int(max(list(str(b))))) + 1
a, b = todecimal(str(a), ma), todecimal(str(b), ma)
ans = a + b

print(len(tobase(ans, ma)))

from sys import stdin
inf=stdin
#inf=open("data1.txt",'rt')

n,m=inf.readline().split(" ")
t=int(max(max(n),max(m)))+1
ans=int(n,t)+int(m,t)
t1=t
val=1
while ans//t1>0:
	val+=1
	t1*=t

print(val)

#n=int(inf.readline())
#s=inf.readline()
# s="bacabcab"
# changed=False
# while not changed:
# 	print(s)
# 	changed=True
# 	i=0
# 	ll=len(s)
# 	while(i+1<ll and ord(s[i])!=ord(s[i+1])+1):
# 		i+=1
# 	j=i+1
# 	while(j+1<ll and ord(s[j])==ord(s[j+1])+1):
# 		j+=1

# 	if(i+1!=ll):
# 		s=s[:i]+s[j+1:]
# 		changed=False
# 	print(i,j,s[:i],s[j+1:])

# 	i=0
# 	ll=len(s)
# 	while(i+1<ll and ord(s[i])!=ord(s[i+1])-1):
# 		i+=1
# 	j=i+1
# 	while(j+1<ll and ord(s[j])==ord(s[j+1])-1):
# 		j+=1
# 	if(i+1!=ll):
# 		s=s[:i+1]+s[j+2:]
# 		changed=False
# 	print(i,j,s[:i+1],s[j+2:])

# print(len(s))
# for i in dicti:
# 	temp=0
# 	for j in helper:
# 		if(j[0]<=i[0] and j[1]<=i[1]):
# 			temp+=(i[0]-j[0]+1)*(i[1]-j[1]+1)
# 		if(j[1]<=i[0] and j[0]<=i[1] and j[0]!=j[1]):
# 			temp+=(i[0]-j[1]+1)*(i[1]-j[0]+1)
# 	count+=temp*dicti[i]

# def all_partitions(string):
#     for cutpoints in range(1 << (len(string)-1)):
#         result = []
#         lastcut = 0
#         for i in range(len(string)-1):
#             if (1<<i) & cutpoints != 0:
#                 result.append(string[lastcut:(i+1)])
#                 lastcut = i+1
#         result.append(string[lastcut:])
#         yield result

# maxyet=0
# store={'h': -6, 'e': -7, 'l': -8, 'o': 3, 'he': 3, 'hel': -3, 'el': 0, 'hell': 6, 'ell': -5, 'll': 10, 'hello': -3, 'ello': -8, 'llo': 9, 'lo': -6}

# def quality(stri):
# 	return store[stri]

# for partition in all_partitions("hel"):
#     temp=0
#     for i in partition:
#     	temp+=quality(i)
#     if(temp>maxyet):
#     	print(partition)
#     	maxyet=temp

# print(maxyet)

# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction

mod = 10 ** 9 + 7
mod1 = 998244353

# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# -------------------game starts now----------------------------------------------------import math
class TreeNode:
    def __init__(self, k, v):
        self.key = k
        self.value = v
        self.left = None
        self.right = None
        self.parent = None
        self.height = 1
        self.num_left = 1
        self.num_total = 1

class AvlTree:

    def __init__(self):
        self._tree = None

    def add(self, k, v):
        if not self._tree:
            self._tree = TreeNode(k, v)
            return
        node = self._add(k, v)
        if node:
            self._rebalance(node)

    def _add(self, k, v):
        node = self._tree
        while node:
            if k < node.key:
                if node.left:
                    node = node.left
                else:
                    node.left = TreeNode(k, v)
                    node.left.parent = node
                    return node.left
            elif node.key < k:
                if node.right:
                    node = node.right
                else:
                    node.right = TreeNode(k, v)
                    node.right.parent = node
                    return node.right
            else:
                node.value = v
                return

    @staticmethod
    def get_height(x):
        return x.height if x else 0

    @staticmethod
    def get_num_total(x):
        return x.num_total if x else 0

    def _rebalance(self, node):

        n = node
        while n:
            lh = self.get_height(n.left)
            rh = self.get_height(n.right)
            n.height = max(lh, rh) + 1
            balance_factor = lh - rh
            n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
            n.num_left = 1 + self.get_num_total(n.left)

            if balance_factor > 1:
                if self.get_height(n.left.left) < self.get_height(n.left.right):
                    self._rotate_left(n.left)
                self._rotate_right(n)
            elif balance_factor < -1:
                if self.get_height(n.right.right) < self.get_height(n.right.left):
                    self._rotate_right(n.right)
                self._rotate_left(n)
            else:
                n = n.parent

    def _remove_one(self, node):
        """
        Side effect!!! Changes node. Node should have exactly one child
        """
        replacement = node.left or node.right
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = replacement
            else:
                node.parent.right = replacement
            replacement.parent = node.parent
            node.parent = None
        else:
            self._tree = replacement
            replacement.parent = None
        node.left = None
        node.right = None
        node.parent = None
        self._rebalance(replacement)

    def _remove_leaf(self, node):
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = None
            else:
                node.parent.right = None
            self._rebalance(node.parent)
        else:
            self._tree = None
        node.parent = None
        node.left = None
        node.right = None

    def remove(self, k):
        node = self._get_node(k)
        if not node:
            return
        if AvlTree._is_leaf(node):
            self._remove_leaf(node)
            return
        if node.left and node.right:
            nxt = AvlTree._get_next(node)
            node.key = nxt.key
            node.value = nxt.value
            if self._is_leaf(nxt):
                self._remove_leaf(nxt)
            else:
                self._remove_one(nxt)
            self._rebalance(node)
        else:
            self._remove_one(node)

    def get(self, k):
        node = self._get_node(k)
        return node.value if node else -1

    def _get_node(self, k):
        if not self._tree:
            return None
        node = self._tree
        while node:
            if k < node.key:
                node = node.left
            elif node.key < k:
                node = node.right
            else:
                return node
        return None

    def get_at(self, pos):
        x = pos + 1
        node = self._tree
        while node:
            if x < node.num_left:
                node = node.left
            elif node.num_left < x:
                x -= node.num_left
                node = node.right
            else:
                return (node.key, node.value)
        raise IndexError("Out of ranges")

    @staticmethod
    def _is_left(node):
        return node.parent.left and node.parent.left == node

    @staticmethod
    def _is_leaf(node):
        return node.left is None and node.right is None

    def _rotate_right(self, node):
        if not node.parent:
            self._tree = node.left
            node.left.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.left
            node.left.parent = node.parent
        else:
            node.parent.right = node.left
            node.left.parent = node.parent
        bk = node.left.right
        node.left.right = node
        node.parent = node.left
        node.left = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    def _rotate_left(self, node):
        if not node.parent:
            self._tree = node.right
            node.right.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.right
            node.right.parent = node.parent
        else:
            node.parent.right = node.right
            node.right.parent = node.parent
        bk = node.right.left
        node.right.left = node
        node.parent = node.right
        node.right = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    @staticmethod
    def _get_next(node):
        if not node.right:
            return node.parent
        n = node.right
        while n.left:
            n = n.left
        return n
avl=AvlTree()
#-----------------------------------------------binary seacrh tree---------------------------------------
class SegmentTree1:
    def __init__(self, data, default='z', func=lambda a, b: min(a ,b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b: a + b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]

class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m

# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z

# --------------------------------------------------product----------------------------------------
def product(l):
    por = 1
    for i in range(len(l)):
        por *= l[i]
    return por

# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left)/ 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid]<=key):
            count = mid+1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count

# --------------------------------------------------binary----------------------------------------
def countdig(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c

def countGreater( arr,n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)
        if (arr[m] >= k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)

# --------------------------------------------------binary------------------------------------
a,b=map(int,input().split())
c=a
n=len(str(a))
n1=len(str(b))
d=b
a=max(str(a))
b=max(str(b))
base=int(max(a,b))+1
t=0
e=0
e1=0
for i in range(n-1,-1,-1):
    e=e+pow(base,t)*(c%10)
    c//=10
    t+=1
t=0
for i in range(n1-1,-1,-1):
    e1=e1+pow(base,t)*(d%10)
    d//=10
    t+=1
rt=e+e1
c=rt
s=""
while(c>0):
    s+=str(c%base)
    c//=base
print(len(s))

a,b=list(map(int,input().split()))
k=int(max(str(a)+str(b)))+1
carry=0
l=max(len(str(a)),len(str(b)))
for itr in range(l):
    if a%10+b%10+carry<k: carry=0
    else: carry=1
    a//=10
    b//=10
    #print(a,b)
if carry: print(l+1)
else: print(l)

#encoding:utf-8
import math

strs = input()
tmp = strs.split(' ')
a = tmp[0]
b = tmp[1]
aL = list(a)
bL = list(b)
aL.reverse()
bL.reverse()
strL = list(strs.replace(" ", ""))
bigest = 0
for i in strL:
    if bigest < int(i):
        bigest = int(i)
base = bigest + 1

if len(aL)>len(bL) :
    lenAB = len(aL)
else:
    lenAB = len(bL)
newNum = []
nextAdd = 0
j = 0
while (j<lenAB or nextAdd != 0):
    if j >= len(aL):
        aL.append(0)
    if j >= len(bL):
        bL.append(0)
    newNum.append((int(aL[j]) + int(bL[j]) + nextAdd) % base)
    nextAdd = int((int(aL[j]) + int(bL[j]) + nextAdd) / base)
    j += 1

print (len(newNum))

a,b=map(int, input().split())
max1=a%10
ch1=a
ch2=b
while a>0:
    if a%10>max1:
        max1=a%10
    a=a//10
max2=b%10
while b>0:
    if b%10>max2:
        max2=b%10
    b=b//10
c=max(max1,max2)
c+=1
ch1=int(str(ch1),c)
ch2=int(str(ch2),c)
sum=ch1+ch2
i=0
while c**i<sum:
    i+=1
if c**i==sum:
    i+=1
print(i)

a, b = map(int, input().split())

mx = 0
for i in range(2, 36):
    is_correct = True
    for j in range(i, 10):
        is_correct &= str(j) not in str(a)
        is_correct &= str(j) not in str(b)

    if is_correct:
        res = int(str(a), i) + int(str(b), i)
        k = 0
        while res:
            k += 1
            res //= i
        mx = max(mx, k)

print(mx)

a, b = input().split()
x = int(max(a + b)) + 1
s, v = int(a, x) + int(b, x), 0
while s:
    s, v = s // x, v + 1
print(v)

#!/usr/bin/env python3

(a,b) = input().split()
highest_digit = max(int(digit) for digit in a+b)
chosen_base = highest_digit + 1
total = int(a, base=chosen_base) + int(b, base=chosen_base)
nr_digits = 0
while (total > 0):
  nr_digits+= 1
  total = total // chosen_base

print(nr_digits)

a, b = list(map(int, input().split()))
a = list(map(int, list(str(a))))[::-1]
b = list(map(int, list(str(b))))[::-1]
bs = max(max(a), max(b)) + 1
head = 0
while len(a) > len(b):
    b.append(0)
while len(b) > len(a):
    a.append(0)
for i in range(len(a)):
    head = (head + a[i] + b[i]) // bs
if head == 0:
    print(len(a))
else:
    print(max(1, head // (bs)) + len(a))

a, b = input().split()
base = int(max(max(a), max(b))) + 1
a, b = int(a, base), int(b, base)
ans, s = 0, a + b
while s:
    s //= base
    ans += 1
print(ans)

a,b=input().split()
c="0123456789ABCDEF"
m="0"
for d in a:
    if d>m: m=d
for d in b:
    if d>m: m=d
n=c.index(m)+1
x=0
st=1
for d in a[::-1]:
    i=c.index(d)
    x+=(i*st)
    st*=n
y=0
st=1
for d in b[::-1]:
    i=c.index(d)
    y+=(i*st)
    st*=n
x+=y
ans=0
while x>0:
    ans+=1
    x//=n
print(ans)

a, b = input().split()
sol=0
for i in range(10, 1, -1):
    try:
        c = int(a, i)+int(b, i)
        s = 0
        while c:
            c//=i
            s+=1
        sol=max(s, sol)
    except ValueError:
        break
print(sol)

a,b = input().split()
arrA = [int(i) for i in str(a)]
arrB = [int(i) for i in str(b)]
def toStr(n,base):
   convertString = "0123456789ABCDEF"
   if n < base:
      return convertString[n]
   else:
      return toStr(n//base,base) + convertString[n%base]
for i in range(0, len(arrB)):
	arrA.append(arrB[i])
base = max(arrA) + 1
A = int(str(a),base)
B = int(str(b),base)
C = A + B
print(len(toStr(C,base)))

a,b=map(int,input().split())
ta=a
tb=b
aa=0
bb=0
while a>0:
	aa=max(aa,a%10)
	a=a//10
while b>0:
	bb=max(bb,b%10)
	b=b//10
base=max(aa,bb)+1
ans=0
p=1
while ta>0:
	a+=(p*(ta%10))
	p*=base
	ta=ta//10
p=1
while tb>0:
	b+=(p*(tb%10))
	p*=base
	tb=tb//10
c=(a+b)
while c>0:
	c=c//base
	ans+=1
print(ans)

import sys

def largest(x):
    ret = 0
    while x > 0:
        ret = max(ret, x%10)
        x //= 10
    return ret

def tobase(x, base):
    ret = 0
    p=1
    while x>0:
        ret+=(x%10)*p
        p*=base
        x //= 10
    return ret

def digitsNum(x, base):
    ret = 0
    while x>0:
        ret += 1
        x //= base
    return ret

n, m= map(int, sys.stdin.read().split())
base = max(largest(n),largest(m)) + 1
x = tobase(n, base) + tobase(m, base)
print(digitsNum(x, base))

import sys

def digitsNum(x, base):
    ret = 0
    while x>0:
        ret += 1
        x //= base
    return ret

n, m= sys.stdin.read().split()

base = int(max(max(n), max(m)))+1
n = int(n, base)
m = int(m, base)

print(digitsNum(n+m, base))

a, b = input().split()
c = int(max(max(a), max(b))) + 1
l = max(len(a), len(b))
k, s = pow(c, l), int(a, c) + int(b, c)
print(l + int(s >= k))

a, b = input().split()

x = int(max(a + b)) + 1

s, v = int(a, x) + int(b, x), 0

while s:

    s, v = s // x, v + 1

print(v)

# Made By Mostafa_Khaled

def maxLength(a, b):
    base = 1 + max(int(c) for c in str(a) + str(b))
    ret, c = 0, int(str(a), base) + int(str(b), base)
    while c > 0:
        ret += 1
        c = c // base
    return ret

def main():
    a, b = [int(s) for s in input().split()]
    print(maxLength(a, b))

if __name__ == '__main__':
    main()

import math

a, b = input().split();
digits = list(str(a) + str(b));
base = int(max(digits)) + 1;

a = int(str(a), base);
b = int(str(b), base);
sumResult = a + b;

start = 1;
result = "";

while (sumResult > 0):
    mod = sumResult % base;
    result += str(mod);
    sumResult = math.floor(sumResult / base);
print(len(result));

def parse_num(num, base):
    ans = 0
    for c in num:
        ans = ans * base + int(c) % 10
        # num //= 10
    return ans

a, b = input().strip().split(" ")

ans = max(len(a), len(b))

base = -1
for c in a + b:
    base = max(int(c), base)
base += 1

# print(parse_num(a, base))
# print(parse_num(b, base))
sum_ = parse_num(a, base) + parse_num(b, base)
# print(sum_)

counter = 0
while sum_:
    # print(sum_)
    counter += 1
    sum_ //= base

print(counter)

ax, bx = map(str, input().split())
d = max([ord(c) - ord('0') for c in ax] + [ord(c) - ord('0') for c in bx]) + 1
ad, bd = 0, 0
for dig in ax:
  ad = ad * d + (ord(dig) - ord('0')) % 10
for dig in bx:
  bd = bd * d + (ord(dig) - ord('0')) % 10
c = ad + bd
ans = 0
while c > 0:
  ans += 1
  c //= d
print(ans)

import string

s = raw_input()
a, b = [i for i in s.split()]
base = max(sorted(i, reverse=True)[0] for i in s.split())
if base in string.digits:
    base = ord(base) - ord('0') + 1
else:
    base = ord(base) - ord('A') + 1
base10 = int(a, base) + int(b, base)

sol = ""
while base10:
    sol = str(base10 % base) + sol
    base10 /= base

print len(sol)

import string
a, b = raw_input().split()
p = max(max([int(i) for i in a]), max([int(j) for j in b])) + 1
an, bn = 0, 0
for i in range(len(a)):
    an += int(a[i])*(p**(len(a)-i-1))
for i in range(len(b)):
    bn += int(b[i])*(p**(len(b)-i-1))
n = ""
x = an + bn
while x > 0:
    y = str(x % p)
    n = y + n
    x = int(x / p)

print len(n)

#!/usr/bin/python

def pos_to_10(n, p):
    x = 0
    pp = 1
    for i in reversed(list(n)):
        r = int(i)
        x += r * pp
        pp *= p
    return x

a, b = raw_input().split()
p = max([int(c) for c in a + b]) + 1
a, b = pos_to_10(a, p), pos_to_10(b, p)
s = a + b
l = 0
while s > 0:
    s /= p
    l += 1
print l

j=0
a,b=raw_input().split(' ')
minbase=int(max(a+b))+1
count=int(a,minbase)+int(b,minbase)
while count:
    count/=minbase
    j+=1
print j

s = raw_input()
ch = max(s)
if not ch.isdigit():
	ch = ord(ch)-55
base = int(ch) + 1

num = sum([int(i, base) for i in s.split()])
ans = 0
while num > 0:
	num = num/base
	ans += 1
print ans

s = raw_input()
ch = max(s)
if not ch.isdigit():
	ch = ord(int(ch))-55
base = int(ch) + 1

a, b = [int(i, base) for i in s.split()]
# print a, b
num = a + b
# print num

ans = 0
while num > 0:
	num = num/base
	ans += 1
print ans

if __name__ == '__main__':
    s1, s2 = raw_input().split()
    c = ord(max(s1 + s2)) - ord('0') + 1
    if len(s1) < len(s2):
        s1 = s1.rjust(len(s2), '0')
    else:
        s2 = s2.rjust(len(s1), '0')
    n1 = map(int, s1)
    n2 = map(int, s2)
    p = 0
    for a, b in zip(n1[::-1], n2[::-1]):
        if a + b + p >= c:
            p = 1
        else:
            p = 0
    print len(n1) + p

a, b = raw_input ().split ()
p = max (map (int, a + b)) + 1
s = int (a, p) + int (b, p)
ans = 0
while s > 0:
    ans += 1
    s /= p
print ans

a, b = raw_input().split()
m = int(max(a + b)) + 1
r = int(a, m) + int(b, m)
l = 0
while r:
  l += 1
  r /= m
print l

#!/usr/bin/env python

a,b = map(int,raw_input().split())

a_str = "%d" % a
b_str = "%d" % b
lowest_base = max([int(i) for i in a_str+b_str]) + 1

total = int(a_str,base = lowest_base) + int(b_str,base = lowest_base)
nr_chars = 0
while total > 0:
  nr_chars += 1
  total = total / lowest_base

print nr_chars

if __name__ == "__main__":
    a, b = raw_input().split()
    base = int(max(a + b)) + 1

    c = int(a, base) + int(b, base)
    result = 0
    while (c):
      result += 1
      c /= base

    print(result)

def get_base(x):
  m = max(x)
  return max(2, (ord(m) - ord("0") if m < "A" else 10 + ord(m) - ord("A")) + 1)
a, b = raw_input().split()
m = max(map(get_base, (a, b)))
r = int(a, m) + int(b, m)
x = str(r % m)
while r:
  r /= m
  if r:
    x += str(r % m)
print len(x)

a, b = raw_input().split()
mx = int(max(a + b)) + 1
v = int(a, mx) + int(b, mx)
l = 0
while (v != 0):
  l += 1
  v /= mx

print l

# -*- coding: utf-8 -*-
line = raw_input().strip('\n')
(a, b) = tuple(line.split(' '))

con = map(int, a+b)
base = max([con[i] for i in range(len(con))]) + 1

sum = int(a, base) + int(b, base)

c = 1
while True:
    if sum/base**c==0:
        print c
        break
    c += 1

[a,b]=raw_input().split();
maxi=0;
for i in a:
    if(i>maxi):
        maxi=i;
for i in b:
    if(i>maxi):
        maxi=i;
base=int(maxi)+1;
deca=0;
decb=0;
multi=len(a)-1;
for i in a:
    deca+=int(i)*pow(base,multi);
    multi-=1;

multi=len(b)-1;
for i in b:
    decb+=int(i)*pow(base,multi);
    multi-=1;

sum=deca+decb;

digits=1;
while(sum>=pow(base,digits)):
    digits+=1;

print(digits)

from __future__ import division
from numpy import *
import sys
from collections import namedtuple #x=namedtuple('point','x y')
from math import *
from collections import deque, OrderedDict #append #popleft
from fractions import gcd
from copy import copy ,deepcopy
from collections import Counter #Counter(list)
import re #re.split("[^a-zA-Z]",text)
# from functools import lru_cache #@lru_cache(maxsize = None)
"""
#reduce(func,list)
#map(func,list)
#filter(func,list)
#xor=lambda x,y :x^y
#sign = lambda x: math.copysign(1, x)
#list.reverse()
#list.sort() list=sorted(list)
list.sort(key=operator.itemgetter(1,2))
#reverse word word[::-1]
#word.islower()
#word.lower() word.upper()
x = x1 if exp1 else x2
any([false,true])
all([true,false])
"a".isalpha()
"1".isdigit()
"""

fin=sys.stdin ;fout=sys.stdout
# fin=open('../in','r') ; fout=open('../out','w')
def readline():
    return fin.readline().strip()
def readstrings():
    return fin.readline().strip().split(' ')
def writeline(value):
    fout.write(str(value))
    fout.write("\n")
def read_integers():
    return [int(x) for x in fin.readline().strip().split(' ')]
def read_integer():
    return int(fin.readline().strip())

def digit_to_char(digit):
    if digit < 10:
      return str(digit)
    return chr(ord('a') + digit - 10)

def str_base(number,base):
    if number < 0:
      return '-' + str_base(-number, base)
    (d, m) = divmod(number, base)
    if d > 0:
        return str_base(d, base) + digit_to_char(m)
    return digit_to_char(m)

numbers=read_integers()

mx=0
for number in numbers:
    for ch in str(number):
        mx=max(int(ch),mx)
a=int(str(numbers[0]),mx+1)
b=int(str(numbers[1]),mx+1)
writeline(len(str_base(a+b,mx+1)))

# coding=UTF-8

#import sys

import sys
from math import *

def main():
    inp = sys.stdin.readline().strip()
    max = 0
    for i in range(0, len(inp)):
        if inp[i] == ' ':
            continue
        if int(inp[i]) > max:
            max = int(inp[i])

    base = max + 1
    sTal = inp.split()

    tal1 = 0
    j = len(sTal[0]) - 1
    for i in range(0, len(sTal[0])):
        tal1 += (base ** j) * int(sTal[0][i])
        j -= 1

    tal2 = 0
    j = len(sTal[1]) - 1
    for i in range(0, len(sTal[1])):
        tal2 += (base ** j) * int(sTal[1][i])
        j -= 1

    sum = tal1 + tal2

    count = 0
    while base**count <= sum:
        count += 1

    pprint(repr(count))

def pprint(str):
    sys.stdout.write(str)
    return

main()

a, b = raw_input().split()
ma, mb = max(a), max(b)
base = int(max(ma, mb)) + 1
da, db = int(a, base), int(b, base)
s = da + db
count = 0
while s > 0:
    count += 1
    s /= base

print count

import math
s = raw_input()
o=2
for i in s:
    if i in "fF":
        if o<16:
            o=16
    if i in "eE":
        if o<15:
            o=15
    if i in "dD":
        if o<14:
            o=14
    if i in "cC":
        if o<13:
            o=13
    if i in "bB":
        if o<12:
            o=12
    if i in "aA":
        if o<11:
            o=11
    if i in '0123456789':
        if o<int(i)+1:
            o=int(i)+1
s=s.split()
summ=int(s[0],o)+int(s[1],o)
a=[1]
for i in range(16,o-1,-1):
    for j in range(10,-1,-1):
        if summ>=math.pow(i,j):
            #print "Osnovanie="+str(i)+", stepen="+str(j)
            a.append(j+1)
print max(a)

# -*- coding: utf-8 -*-
import sys
import string

def cha(num,base):
    v = 0
    rest = 0
    while(num != 0):
        rest += (num%10) * (base ** v)
        num /= 10
        v +=1

    return rest

if __name__ == '__main__':
    str1,str2 = map(str,sys.stdin.readline().split())

    max = 0
    for v in (str1+str2):
        if int(v) > max:
            max = int(v)

    start = cha(int(str1),max+1) + cha(int(str2),max+1)
    i=1
    while (start/(max+1) != 0):
        start /=(max+1)
        i+=1
    print i

a=[0,0]
tmp=raw_input().split()
base=int(max(tmp[0]+tmp[1]))+1
a[0]=int(tmp[0],base)
a[1]=int(tmp[1],base)

n=1
k=base
s=sum(a)
while k<=s:
    k*=base
    #print base
    n+=1
print n

import sys
import math
import time
from Queue import Queue
from sets import Set

class pythonin:
    _data = []
    _ldata = []
    _cur = 0
    _lcur = 0

    def __init__(self):
        while True:
            try: self._ldata.append(raw_input())
            except EOFError : break

    def _convert(self):
        if self._lcur == len(self._ldata) : return
        l = self._ldata[self._lcur].split(" ")
        self._lcur += 1
        for x in l :
            if x != "" and x != "\t" :
                self._data.append(x)

    def eof(self) :
        self._convert()
        return self._cur == len(self._data)

    def nextToken(self) :
        if self.eof() : return
        self._cur += 1
        return self._data[self._cur - 1]

    def nextInt(self) :
        return int(self.nextToken())

    def nextFloat(self) :
        return float(self.nextToken())

    def nextLine(self) :
        if self._lcur == len(self._ldata) : return
        self._lcur += 1
        return self._ldata[self._lcur - 1]

#sys.stdin = open("input.txt", "r")
#sys.stdout = open("output.txt", "w")

pin = pythonin()

a = pin.nextInt()
b = pin.nextInt()

def toBase(x, base) :
    sum = 0
    for c in str(x) :
        sum *= base
        sum += int(c)
    return sum

def clBase(x, base) :
    res = 0
    while x > 0:
        x /= base
        res += 1
    return res

res = 0

for base in range(max([int(c) for c in Set(str(a) + str(b))]) + 1, 1000) :
    res = max(res, clBase(toBase(a, base) + toBase(b, base), base))

print res

#print ("Press any key to continue")
#raw_input()

import sys
import math
import time
from Queue import Queue
from sets import Set

class pythonin:
    _data = []
    _ldata = []
    _cur = 0
    _lcur = 0

    def __init__(self):
        while True:
            try: self._ldata.append(raw_input())
            except EOFError : break

    def _convert(self):
        if self._lcur == len(self._ldata) : return
        l = self._ldata[self._lcur].split(" ")
        self._lcur += 1
        for x in l :
            if x != "" and x != "\t" :
                self._data.append(x)

    def eof(self) :
        self._convert()
        return self._cur == len(self._data)

    def nextToken(self) :
        if self.eof() : return
        self._cur += 1
        return self._data[self._cur - 1]

    def nextInt(self) :
        return int(self.nextToken())

    def nextFloat(self) :
        return float(self.nextToken())

    def nextLine(self) :
        if self._lcur == len(self._ldata) : return
        self._lcur += 1
        return self._ldata[self._lcur - 1]

#sys.stdin = open("input.txt", "r")
#sys.stdout = open("output.txt", "w")

pin = pythonin()

a = pin.nextInt()
b = pin.nextInt()

def toBase(x, base) :
    sum = 0
    for c in str(x) :
        sum *= base
        sum += int(c)
    return sum

def clBase(x, base) :
    res = 0
    while x > 0:
        x /= base
        res += 1
    return res

res = 0

for base in range(max([int(c) for c in Set(list(str(a) + str(b)))]) + 1, 1000) :
    res = max(res, clBase(toBase(a, base) + toBase(b, base), base))

print res

#print ("Press any key to continue")
#raw_input()

a, b = raw_input().split()
ans = 0
for i in xrange(2, 37):
    try:
        c = int(a, i) + int(b, i)
        res = 0
        while c > 0:
            c /= i
            res += 1
        ans = max(ans, res)
    except ValueError,e:
        pass

print ans

text = raw_input()
a, b = text.split()
base = (int)(max(a + b))
base += 1
sum = int(a, base) + int(b, base)
ret = 0
while (sum > 0) :
    ret += 1
    sum /= base

print(ret);

import sys
line = sys.stdin.readline().strip();
a = line.split(" ")[0];
b = line.split(" ")[1];
s = a + b;
m = 0;
for c in s :
    d = int(c);
    m = max(m, d);

t = int(a, (m+1)) + int(b,(m+1))
ret = "";
while (t != 0):
    r = t % (m + 1);
    t //= (m + 1);
    ret = ret + str(r);
print(len(ret));

s = raw_input().split()
mx, up = -1, 0
if len(s[0])>len(s[1]): s.reverse()
s[0] = (len(s[1])-len(s[0]))*'0' + s[0]
for i in xrange(len(s[0])):
    mx = max(mx,int(s[0][i]))
    mx = max(mx,int(s[1][i]))
p = mx + 1
for i in xrange(len(s[0])):
    if int(s[0][len(s[0])-1-i]) + int(s[1][len(s[0])-1-i]) + up >= p:    up = 1
    else: up = 0
print len(s[0]) + up

# -*- coding: UTF-8 -*-

# from itertools import *
# from collections import defaultdict
def base10toN(num,n):
   return ((num == 0) and  "0" ) or ( base10toN(num // n, n).strip("0") + "0123456789abcdefghijklmnopqrstuvwxyz"[:n][num % n])
T = raw_input().split()

base = int(max(T[0]+T[1]))+1
sum_max = int(T[0], base) + int(T[1], base)
print len(str(base10toN(sum_max, base)))

a, b = [int(i) for i in raw_input().split()]

maxdigit = max([ord(i) for i in str(a)] + [ord(i) for i in str(b)])
maxdigit = int(chr(maxdigit))

sm = a + b

import math

print int(math.ceil(math.log(sm + 1, maxdigit + 1)))

__author__ = 'MoustaphaSaad'
line = raw_input().split()
base = 0
for num in line:
    for d in num:
        base = max(base, int(d))
a, b = int(line[0]), int(line[1])
car, lene= 0, 0
while a != 0 or b != 0:
    tmp = a%10 + b%10 + car
    car = tmp / base
    a /= 10
    b /= 10
    lene += 1
if car > 0:
    lene += 1

print lene

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def test_len(n1, n2, base):
    if len(n1) > len(n2):
        s = map(int, n1)
        n = n2
    else:
        s = map(int, n2)
        n = n1
    s.insert(0, 0)
    for i in xrange(len(n)):
        s[-i-1] += int(n[-i-1])
        if s[-i-1] >= base:
            s[-i-2] += s[-i-1] - base
            s[-i-1] -= base
    return len(s) - (1 if s[0] != 0 else 0)

def main():
    a, b = raw_input().split()
    mbase = max([int(s) for s in a + b])
    print max([test_len(a, b, base) for base in xrange(16, mbase, -1)])
    return 0

if __name__ == '__main__':
    main()

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def test_len(n1, n2, base):
    if len(n1) > len(n2):
        s = map(int, n1)
        n = n2
    else:
        s = map(int, n2)
        n = n1
    s.insert(0, 0)
    for i in xrange(len(n)):
        s[-i-1] += int(n[-i-1])
        while s[-i-1] >= base:
            s[-i-2] += 1
            s[-i-1] -= base
    if s[0] == 0:
        s.pop(0)
    return len(s)

def main():
    a, b = raw_input().split()
    mbase = max([int(s) for s in a + b])
    print max([test_len(a, b, base) for base in xrange(16, mbase, -1)])
    return 0

if __name__ == '__main__':
    main()

s = raw_input()
a1, a2 = map(int, s.split())
sys = int(max(s)) + 1
c = a1 + a2
count = 1
while c / sys != 0:
    c = c / sys
    count += 1
print count

s = raw_input()
a1, a2 = s.split()
sys = int(max(s)) + 1
c = str(int(a1, sys) + int(a2, sys))
print len(c)

from sys import stdin

a, b = next(stdin).split()
max1 = max(a)
max1 = int(max(b)) if max(b) > max1 else int(max1)
max1 += 1
n = int(a) + int(b)
count = 0
while n > 0:
  n //= max1
  count += 1
print(count)

#Code by Sounak, IIESTS
#------------------------------warmup----------------------------

import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------game starts now-----------------------------------------------------
a,b=map(int,input().split())
mx=1
copy=a
while copy>0:
    t=copy%10
    mx=max(mx,t)
    copy//=10
copy=b
while copy>0:
    t=copy%10
    mx=max(mx,t)
    copy//=10
base=mx+1
#print (mx)
ct=0
c=a+b
while c>0:
    ct+=1
    c//=base
print(ct)

a, b = map(int, input().split())
c = a + b
m = 0
for i in str(a):
    m = max(m, int(i))
for i in str(b):
    m = max(m, int(i))

m += 1
ans = 0
t = 1
while t * m <= c:
    t *= m
    ans += 1
print(ans + 1)

from collections import *

letters = '0123456789ABCDEF'

def tobase(s, base):
    res = deque([])
    if s == 0:
        return 0
    while (s != 0):
        res.appendleft(letters[s % base])
        s //= base
    return ''.join(res)

a, b = map(int, input().split())
ma1, ma2 = int(max(list(str(a)))), int(max(list(str(b))))
ans = a + b
print(len(tobase(ans, max(ma1, ma2) + 1)))

from sys import stdin
inf=stdin
#inf=open("data1.txt",'rt')

n,m=inf.readline().split(" ")
t=int(max(max(n),max(m)))+1
ans=int(n,t+1)+int(m,t+1)

t1=t
val=1
while ans//t1>0:
	val+=1
	t1*=t

print(val)

#n=int(inf.readline())
#s=inf.readline()
# s="bacabcab"
# changed=False
# while not changed:
# 	print(s)
# 	changed=True
# 	i=0
# 	ll=len(s)
# 	while(i+1<ll and ord(s[i])!=ord(s[i+1])+1):
# 		i+=1
# 	j=i+1
# 	while(j+1<ll and ord(s[j])==ord(s[j+1])+1):
# 		j+=1

# 	if(i+1!=ll):
# 		s=s[:i]+s[j+1:]
# 		changed=False
# 	print(i,j,s[:i],s[j+1:])

# 	i=0
# 	ll=len(s)
# 	while(i+1<ll and ord(s[i])!=ord(s[i+1])-1):
# 		i+=1
# 	j=i+1
# 	while(j+1<ll and ord(s[j])==ord(s[j+1])-1):
# 		j+=1
# 	if(i+1!=ll):
# 		s=s[:i+1]+s[j+2:]
# 		changed=False
# 	print(i,j,s[:i+1],s[j+2:])

# print(len(s))
# for i in dicti:
# 	temp=0
# 	for j in helper:
# 		if(j[0]<=i[0] and j[1]<=i[1]):
# 			temp+=(i[0]-j[0]+1)*(i[1]-j[1]+1)
# 		if(j[1]<=i[0] and j[0]<=i[1] and j[0]!=j[1]):
# 			temp+=(i[0]-j[1]+1)*(i[1]-j[0]+1)
# 	count+=temp*dicti[i]

# def all_partitions(string):
#     for cutpoints in range(1 << (len(string)-1)):
#         result = []
#         lastcut = 0
#         for i in range(len(string)-1):
#             if (1<<i) & cutpoints != 0:
#                 result.append(string[lastcut:(i+1)])
#                 lastcut = i+1
#         result.append(string[lastcut:])
#         yield result

# maxyet=0
# store={'h': -6, 'e': -7, 'l': -8, 'o': 3, 'he': 3, 'hel': -3, 'el': 0, 'hell': 6, 'ell': -5, 'll': 10, 'hello': -3, 'ello': -8, 'llo': 9, 'lo': -6}

# def quality(stri):
# 	return store[stri]

# for partition in all_partitions("hel"):
#     temp=0
#     for i in partition:
#     	temp+=quality(i)
#     if(temp>maxyet):
#     	print(partition)
#     	maxyet=temp

# print(maxyet)

# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction

mod = 10 ** 9 + 7
mod1 = 998244353

# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# -------------------game starts now----------------------------------------------------import math
class TreeNode:
    def __init__(self, k, v):
        self.key = k
        self.value = v
        self.left = None
        self.right = None
        self.parent = None
        self.height = 1
        self.num_left = 1
        self.num_total = 1

class AvlTree:

    def __init__(self):
        self._tree = None

    def add(self, k, v):
        if not self._tree:
            self._tree = TreeNode(k, v)
            return
        node = self._add(k, v)
        if node:
            self._rebalance(node)

    def _add(self, k, v):
        node = self._tree
        while node:
            if k < node.key:
                if node.left:
                    node = node.left
                else:
                    node.left = TreeNode(k, v)
                    node.left.parent = node
                    return node.left
            elif node.key < k:
                if node.right:
                    node = node.right
                else:
                    node.right = TreeNode(k, v)
                    node.right.parent = node
                    return node.right
            else:
                node.value = v
                return

    @staticmethod
    def get_height(x):
        return x.height if x else 0

    @staticmethod
    def get_num_total(x):
        return x.num_total if x else 0

    def _rebalance(self, node):

        n = node
        while n:
            lh = self.get_height(n.left)
            rh = self.get_height(n.right)
            n.height = max(lh, rh) + 1
            balance_factor = lh - rh
            n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
            n.num_left = 1 + self.get_num_total(n.left)

            if balance_factor > 1:
                if self.get_height(n.left.left) < self.get_height(n.left.right):
                    self._rotate_left(n.left)
                self._rotate_right(n)
            elif balance_factor < -1:
                if self.get_height(n.right.right) < self.get_height(n.right.left):
                    self._rotate_right(n.right)
                self._rotate_left(n)
            else:
                n = n.parent

    def _remove_one(self, node):
        """
        Side effect!!! Changes node. Node should have exactly one child
        """
        replacement = node.left or node.right
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = replacement
            else:
                node.parent.right = replacement
            replacement.parent = node.parent
            node.parent = None
        else:
            self._tree = replacement
            replacement.parent = None
        node.left = None
        node.right = None
        node.parent = None
        self._rebalance(replacement)

    def _remove_leaf(self, node):
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = None
            else:
                node.parent.right = None
            self._rebalance(node.parent)
        else:
            self._tree = None
        node.parent = None
        node.left = None
        node.right = None

    def remove(self, k):
        node = self._get_node(k)
        if not node:
            return
        if AvlTree._is_leaf(node):
            self._remove_leaf(node)
            return
        if node.left and node.right:
            nxt = AvlTree._get_next(node)
            node.key = nxt.key
            node.value = nxt.value
            if self._is_leaf(nxt):
                self._remove_leaf(nxt)
            else:
                self._remove_one(nxt)
            self._rebalance(node)
        else:
            self._remove_one(node)

    def get(self, k):
        node = self._get_node(k)
        return node.value if node else -1

    def _get_node(self, k):
        if not self._tree:
            return None
        node = self._tree
        while node:
            if k < node.key:
                node = node.left
            elif node.key < k:
                node = node.right
            else:
                return node
        return None

    def get_at(self, pos):
        x = pos + 1
        node = self._tree
        while node:
            if x < node.num_left:
                node = node.left
            elif node.num_left < x:
                x -= node.num_left
                node = node.right
            else:
                return (node.key, node.value)
        raise IndexError("Out of ranges")

    @staticmethod
    def _is_left(node):
        return node.parent.left and node.parent.left == node

    @staticmethod
    def _is_leaf(node):
        return node.left is None and node.right is None

    def _rotate_right(self, node):
        if not node.parent:
            self._tree = node.left
            node.left.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.left
            node.left.parent = node.parent
        else:
            node.parent.right = node.left
            node.left.parent = node.parent
        bk = node.left.right
        node.left.right = node
        node.parent = node.left
        node.left = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    def _rotate_left(self, node):
        if not node.parent:
            self._tree = node.right
            node.right.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.right
            node.right.parent = node.parent
        else:
            node.parent.right = node.right
            node.right.parent = node.parent
        bk = node.right.left
        node.right.left = node
        node.parent = node.right
        node.right = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    @staticmethod
    def _get_next(node):
        if not node.right:
            return node.parent
        n = node.right
        while n.left:
            n = n.left
        return n
avl=AvlTree()
#-----------------------------------------------binary seacrh tree---------------------------------------
class SegmentTree1:
    def __init__(self, data, default='z', func=lambda a, b: min(a ,b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b: a + b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]

class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m

# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z

# --------------------------------------------------product----------------------------------------
def product(l):
    por = 1
    for i in range(len(l)):
        por *= l[i]
    return por

# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left)/ 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid]<=key):
            count = mid+1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count

# --------------------------------------------------binary----------------------------------------
def countdig(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c

def countGreater( arr,n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)
        if (arr[m] >= k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)

# --------------------------------------------------binary------------------------------------
a,b=map(int,input().split())
c=a
n=len(str(a))
n1=len(str(b))
d=b
a=max(str(a))
b=max(str(a))
base=int(max(a,b))+1
t=0
e=0
e1=0
for i in range(n-1,-1,-1):
    e=e+pow(base,t)*(c%10)
    c//=10
    t+=1
t=0
for i in range(n1-1,-1,-1):
    e1=e1+pow(base,t)*(d%10)
    d//=10
    t+=1
rt=e+e1
c=rt
s=""
while(c>0):
    s+=str(c%base)
    c//=base
print(len(s))

# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction

mod = 10 ** 9 + 7
mod1 = 998244353

# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# -------------------game starts now----------------------------------------------------import math
class TreeNode:
    def __init__(self, k, v):
        self.key = k
        self.value = v
        self.left = None
        self.right = None
        self.parent = None
        self.height = 1
        self.num_left = 1
        self.num_total = 1

class AvlTree:

    def __init__(self):
        self._tree = None

    def add(self, k, v):
        if not self._tree:
            self._tree = TreeNode(k, v)
            return
        node = self._add(k, v)
        if node:
            self._rebalance(node)

    def _add(self, k, v):
        node = self._tree
        while node:
            if k < node.key:
                if node.left:
                    node = node.left
                else:
                    node.left = TreeNode(k, v)
                    node.left.parent = node
                    return node.left
            elif node.key < k:
                if node.right:
                    node = node.right
                else:
                    node.right = TreeNode(k, v)
                    node.right.parent = node
                    return node.right
            else:
                node.value = v
                return

    @staticmethod
    def get_height(x):
        return x.height if x else 0

    @staticmethod
    def get_num_total(x):
        return x.num_total if x else 0

    def _rebalance(self, node):

        n = node
        while n:
            lh = self.get_height(n.left)
            rh = self.get_height(n.right)
            n.height = max(lh, rh) + 1
            balance_factor = lh - rh
            n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
            n.num_left = 1 + self.get_num_total(n.left)

            if balance_factor > 1:
                if self.get_height(n.left.left) < self.get_height(n.left.right):
                    self._rotate_left(n.left)
                self._rotate_right(n)
            elif balance_factor < -1:
                if self.get_height(n.right.right) < self.get_height(n.right.left):
                    self._rotate_right(n.right)
                self._rotate_left(n)
            else:
                n = n.parent

    def _remove_one(self, node):
        """
        Side effect!!! Changes node. Node should have exactly one child
        """
        replacement = node.left or node.right
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = replacement
            else:
                node.parent.right = replacement
            replacement.parent = node.parent
            node.parent = None
        else:
            self._tree = replacement
            replacement.parent = None
        node.left = None
        node.right = None
        node.parent = None
        self._rebalance(replacement)

    def _remove_leaf(self, node):
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = None
            else:
                node.parent.right = None
            self._rebalance(node.parent)
        else:
            self._tree = None
        node.parent = None
        node.left = None
        node.right = None

    def remove(self, k):
        node = self._get_node(k)
        if not node:
            return
        if AvlTree._is_leaf(node):
            self._remove_leaf(node)
            return
        if node.left and node.right:
            nxt = AvlTree._get_next(node)
            node.key = nxt.key
            node.value = nxt.value
            if self._is_leaf(nxt):
                self._remove_leaf(nxt)
            else:
                self._remove_one(nxt)
            self._rebalance(node)
        else:
            self._remove_one(node)

    def get(self, k):
        node = self._get_node(k)
        return node.value if node else -1

    def _get_node(self, k):
        if not self._tree:
            return None
        node = self._tree
        while node:
            if k < node.key:
                node = node.left
            elif node.key < k:
                node = node.right
            else:
                return node
        return None

    def get_at(self, pos):
        x = pos + 1
        node = self._tree
        while node:
            if x < node.num_left:
                node = node.left
            elif node.num_left < x:
                x -= node.num_left
                node = node.right
            else:
                return (node.key, node.value)
        raise IndexError("Out of ranges")

    @staticmethod
    def _is_left(node):
        return node.parent.left and node.parent.left == node

    @staticmethod
    def _is_leaf(node):
        return node.left is None and node.right is None

    def _rotate_right(self, node):
        if not node.parent:
            self._tree = node.left
            node.left.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.left
            node.left.parent = node.parent
        else:
            node.parent.right = node.left
            node.left.parent = node.parent
        bk = node.left.right
        node.left.right = node
        node.parent = node.left
        node.left = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    def _rotate_left(self, node):
        if not node.parent:
            self._tree = node.right
            node.right.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.right
            node.right.parent = node.parent
        else:
            node.parent.right = node.right
            node.right.parent = node.parent
        bk = node.right.left
        node.right.left = node
        node.parent = node.right
        node.right = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    @staticmethod
    def _get_next(node):
        if not node.right:
            return node.parent
        n = node.right
        while n.left:
            n = n.left
        return n
avl=AvlTree()
#-----------------------------------------------binary seacrh tree---------------------------------------
class SegmentTree1:
    def __init__(self, data, default='z', func=lambda a, b: min(a ,b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b: a + b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]

class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m

# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z

# --------------------------------------------------product----------------------------------------
def product(l):
    por = 1
    for i in range(len(l)):
        por *= l[i]
    return por

# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left)/ 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid]<=key):
            count = mid+1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count

# --------------------------------------------------binary----------------------------------------
def countdig(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c

def countGreater( arr,n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)
        if (arr[m] >= k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)

# --------------------------------------------------binary------------------------------------
a,b=map(int,input().split())
c=a+b
a=max(str(a))
b=max(str(a))
base=int(max(a,b))+1
s=""
while(c>0):
    s+=str(c%base)
    c//=base
print(len(s))

a,b=list(map(int,input().split()))
k=int(max(str(a)+str(b)))+1
carry=0
l=max(len(str(a)),len(str(b)))
for itr in range(l):
    if a%10+b%10+carry<k: carry=0
    else: carry=1
    a//=10
    b//=10
    print(a,b)
if carry: print(l+1)
else: print(l)

a, b = map(int, input().split())

for i in range(2, 10):
    is_correct = True
    for j in range(i, 10):
        is_correct &= str(j) not in str(a)
        is_correct &= str(j) not in str(b)

    if is_correct:
        res = int(str(a), i) + int(str(b), i)
        k = 0
        while res:
            k += 1
            res //= i
        print(k)
        break

a, b = list(map(int, input().split()))
a = list(map(int, list(str(a))))[::-1]
b = list(map(int, list(str(b))))[::-1]
bs = max(max(a), max(b)) + 1
head = 0
while len(a) > len(b):
    b.append(0)
while len(b) > len(a):
    a.append(0)
for i in range(len(a)):
    head = max(0, head + a[i] + b[i] - (bs - 1))
if head == 0:
    print(a)
else:
    print(max(1, head // bs) + len(a))

a, b = list(map(int, input().split()))
a = list(map(int, list(str(a))))[::-1]
b = list(map(int, list(str(b))))[::-1]
bs = max(max(a), max(b)) + 1
head = 0
while len(a) > len(b):
    b.append(0)
while len(b) > len(a):
    a.append(0)
for i in range(len(a)):
    head = max(0, head + a[i] + b[i] - (bs - 1))
if head == 0:
    print(len(a))
else:
    print(max(1, head // (bs - 1)) + len(a))

a, b = list(map(int, input().split()))
a = list(map(int, list(str(a))))[::-1]
b = list(map(int, list(str(b))))[::-1]
bs = max(max(a), max(b)) + 1
head = 0
while len(a) > len(b):
    b.append(0)
while len(b) > len(a):
    a.append(0)
for i in range(len(a)):
    head = max(0, head + a[i] + b[i] - (bs - 1))
if head == 0:
    print(len(a))
else:
    print(max(1, head // bs) + len(a))

a, b = list(map(int, input().split()))
a = list(map(int, list(str(a))))[::-1]
b = list(map(int, list(str(b))))[::-1]
bs = max(max(a), max(b)) + 1
head = 0
while len(a) > len(b):
    b.append(0)
while len(b) > len(a):
    a.append(0)
for i in range(len(a)):
    head = max(0, head + a[i] + b[i] - (bs - 1))
cnt = head // (bs - 1) + len(a)
print(cnt)

a,b=input().split()
c="0123456789ABCDEF"
m="0"
for d in a:
    if d>m: m=d
for d in b:
    if d>m: m=d
n=c.index(m)+1

x=0
st=1
for d in a:
    i=c.index(m)
    x+=(i*st)
    st*=n
y=0
st=1
for d in b:
    i=c.index(m)
    y+=(i*st)
    st*=n
x+=y
ans=0
while x>0:
    ans+=1
    x//=n
print(ans)

a,b=input().split()
c="0123456789ABCDEF"
m="0"
for d in a:
    if d>m: m=d
for d in b:
    if d>m: m=d
n=c.index(m)+1
x=0
st=1
for d in a:
    i=c.index(d)
    x+=(i*st)
    st*=n
y=0
st=1
for d in b:
    i=c.index(d)
    y+=(i*st)
    st*=n
x+=y
ans=0
while x>0:
    ans+=1
    x//=n
print(ans)

import math

a, b = input().split();
sumResult = int(a) + int(b);
digits = list(str(a) + str(b));
base = int(max(digits)) + 1;

start = 1;
result = "";

while (sumResult > 0):
    mod = sumResult % base;
    result += str(mod);
    sumResult = math.floor(sumResult / base);
print(len(result));

def parse_num(num, base):
    num = int(num)
    ans = 0
    while num:
        ans = ans * base + num % 10
        num //= 10
    return ans

a, b = input().strip().split(" ")

ans = max(len(a), len(b))

base = -1
for c in a + b:
    base = max(int(c), base)
base += 1

# print(parse_num(a, base))
# print(parse_num(b, base))
sum_ = parse_num(a, base) + parse_num(b, base)
# print(sum_)

counter = 0
while sum_:
    counter += 1
    sum_ //= base

print(counter)

ax, bx = map(str, input().split())
a, b = int(ax), int(bx)
d = max([ord(c) - ord('0') for c in ax] + [ord(c) - ord('0') for c in bx]) + 1
ad, bd = 0, 0
while a > 0:
  ad = ad * d + a % 10
  a //= 10
while b > 0:
  bd = bd * d + b % 10
  b //= 10
c = ad + bd
ans = 0
while c > 0:
  ans += 1
  c //= d
print(ans)

import string
a, b = raw_input().split()
p = max(max([int(i) for i in a]), max([int(j) for j in b])) + 1
an, bn = 0, 0
for i in a:
    an += int(i)*(p**(len(a)-a.index(i)-1))
for i in b:
    bn += int(i)*(p**(len(b)-b.index(i)-1))

n = ""
x = an + bn
while x > 0:
    y = str(x % p)
    n = y + n
    x = int(x / p)

print len(n)

import string
a, b = raw_input().split()
p = max(max([int(i) for i in a]), max([int(j) for j in b])) + 1
an, bn = 0, 0
for i in range(len(a)):
    an += int(a[i])*(p**(len(a)-i-1))
for i in range(len(b)):
    bn += int(a[i])*(p**(len(b)-i-1))

n = ""
x = an + bn
while x > 0:
    y = str(x % p)
    n = y + n
    x = int(x / p)
print len(n)

#!/usr/bin/python

a, b = raw_input().split()
p = max([int(c) for c in a + b]) + 1
s = int(a) + int(b)
l = 0
while s > 0:
    s /= p
    l += 1
print l

s = raw_input()
ch = max(s)
if not ch.isdigit():
	ch = ord(ch)-55
base = int(ch) + 1
print base

num = sum([int(i, base) for i in s.split()])
ans = 0
while num > 0:
	num = num/base
	ans += 1
print ans

if __name__ == "__main__":
    a, b = raw_input().split()
    base = int(max(a + b)) + 1

    c = int(a, base) + int(b, base)
    result = 1
    while (c):
      result += 1
      c /= base

    print(result)

from __future__ import division
from numpy import *
import sys
from collections import namedtuple #x=namedtuple('point','x y')
from math import *
from collections import deque, OrderedDict #append #popleft
from fractions import gcd
from copy import copy ,deepcopy
from collections import Counter #Counter(list)
import re #re.split("[^a-zA-Z]",text)
# from functools import lru_cache #@lru_cache(maxsize = None)
"""
#reduce(func,list)
#map(func,list)
#filter(func,list)
#xor=lambda x,y :x^y
#sign = lambda x: math.copysign(1, x)
#list.reverse()
#list.sort() list=sorted(list)
list.sort(key=operator.itemgetter(1,2))
#reverse word word[::-1]
#word.islower()
#word.lower() word.upper()
x = x1 if exp1 else x2
any([false,true])
all([true,false])
"a".isalpha()
"1".isdigit()
"""

fin=sys.stdin ;fout=sys.stdout
# fin=open('../in','r') ; fout=open('../out','w')
def readline():
    return fin.readline().strip()
def readstrings():
    return fin.readline().strip().split(' ')
def writeline(value):
    fout.write(str(value))
    fout.write("\n")
def read_integers():
    return [int(x) for x in fin.readline().strip().split(' ')]
def read_integer():
    return int(fin.readline().strip())

numbers=read_integers()

mx=0
for number in numbers:
    for ch in str(number):
        mx=max(int(ch),mx)
a=int(str(numbers[0]),mx+1)
b=int(str(numbers[1]),mx+1)
writeline(len(str(a+b)))

from __future__ import division
from numpy import *
import sys
from collections import namedtuple #x=namedtuple('point','x y')
from math import *
from collections import deque, OrderedDict #append #popleft
from fractions import gcd
from copy import copy ,deepcopy
from collections import Counter #Counter(list)
import re #re.split("[^a-zA-Z]",text)
# from functools import lru_cache #@lru_cache(maxsize = None)
"""
#reduce(func,list)
#map(func,list)
#filter(func,list)
#xor=lambda x,y :x^y
#sign = lambda x: math.copysign(1, x)
#list.reverse()
#list.sort() list=sorted(list)
list.sort(key=operator.itemgetter(1,2))
#reverse word word[::-1]
#word.islower()
#word.lower() word.upper()
x = x1 if exp1 else x2
any([false,true])
all([true,false])
"a".isalpha()
"1".isdigit()
"""

fin=sys.stdin ;fout=sys.stdout
# fin=open('../in','r') ; fout=open('../out','w')
def readline():
    return fin.readline().strip()
def readstrings():
    return fin.readline().strip().split(' ')
def writeline(value):
    fout.write(str(value))
    fout.write("\n")
def read_integers():
    return [int(x) for x in fin.readline().strip().split(' ')]
def read_integer():
    return int(fin.readline().strip())

def digit_to_char(digit):
    if digit < 10:
      return str(digit)
    return chr(ord('a') + digit - 10)

def str_base(number,base):
    if number < 0:
      return '-' + str_base(-number, base)
    (d, m) = divmod(number, base)
    if d > 0:
        return str_base(d, base) + digit_to_char(m)
    return digit_to_char(m)

numbers=read_integers()

mx=0
for number in numbers:
    for ch in str(number):
        mx=max(int(ch),mx)

writeline(len(str_base(numbers[0]+numbers[1],mx+1)))

# -*- coding: utf-8 -*-
import sys
import string

if __name__ == '__main__':
    str1,str2 = map(str,sys.stdin.readline().split())

    max = 0
    for v in (str1+str2):
        if int(v) > max:
            max = int(v)

    start = int(str1)+int(str2)
    i=1
    while (start/(max+1) != 0):
        start /=(max+1)
        i+=1
    print i

a=[0,0]
tmp=raw_input().split()
a[0]=int(tmp[0])
a[1]=int(tmp[1])
base=int(max(tmp[0]+tmp[1]))+1
n=1
k=base
s=sum(a)
while k<=s:
    k*=base
    #print base
    n+=1
print n

import sys
line = sys.stdin.readline().strip();
a = line.split(" ")[0];
b = line.split(" ")[1];
s = a + b;
m = 0;
for c in s :
    d = int(c);
    m = max(m, d);

t = int(a) + int(b)
ret = "";
while (t != 0):
    r = t % (m + 1);
    t //= (m + 1);
    ret = ret + str(r);
print(len(ret));

s = raw_input().split()
a, b, c, mx, up = [], [], [], -1, 0
for i in xrange(len(s[0])):
    a.append(int(s[0][i]))
    mx = max(mx,a[i])
for i in xrange(len(s[1])):
    b.append(int(s[1][i]))
    mx = max(mx,b[i])
for _ in xrange(10):
    a.append(0)
    b.append(0)
p = mx + 1
for i in xrange(max(len(s[1]),len(s[0]))):
    if a[i] + b[i] + up >= p:    up = 1
    else: up = 0
print max(len(s[1]),len(s[0])) + up

s = raw_input().split()
a, b, c, mx, up = [], [], [], -1, 0
for i in xrange(len(s[0])):
    a.append(int(s[0][i]))
    mx = max(mx,a[i])
for i in xrange(len(s[1])):
    b.append(int(s[1][i]))
    mx = max(mx,b[i])
for _ in xrange(10):
    a.append(0)
    b.append(0)
p = mx + 1
for i in xrange(min(len(s[1]),len(s[0]))):
    if a[i] + b[i] + up >= p:    up = 1
    else: up = 0
print max(len(s[1]),len(s[0])) + up