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.

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int a,b;
	cin>>a>>b;
	int m = a , n=b;
	int base = INT_MIN;
	while(a!=0)
	{
		base = max(base , a%10);
		a =a/10;
	}
	while(b!=0)
	{
		base = max(base , b%10);
		b = b/10;
	}
	base++;

	int ans = 0 , sum = 0;

	while(n!=0 || m!=0)
	{
		sum += (n%10)+(m%10);
		sum = sum/base;
		n = n/10;
		m = m/10;
		ans++;
	}
	if(sum>0)
	 ans++;
	cout<<ans<<endl;

}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x, y; cin >> x >> y;
    int a = x, b = y;
    int base = 0;

    while(a) {
        base = max(base, a%10);
        a = a/10;
    }
    while(b) {
        base = max(base, b%10);
        b = b/10;
    }

    base++;
    int len = 0, carry = 0;
    while(x || y) {
        int ans = x%10 + y%10 + carry;
        carry = ans / base;
        y /= 10;
        x /= 10;
        len++;
    }
    if(carry){
        len++;
    }

    cout << len;
    return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
int mx=0;
void getmxd(int n)
{

    for(;n;n/=10)
    {
       mx=max(mx,n%10);
    }
}
int getlen(int x,int y,int base)
{
    int c=0,l=0,r;
    while(x || y || c)
    {
        r=c;
        if(x)
            r+=x%10 ,x/=10;
        if(y)
            r+=y%10 ,y/=10;
        l++;
        c=r/base;
    }
    return l;
}
int main()
{
    int a,b,l=-1;
    cin>>a>>b;
    getmxd(a);
    getmxd(b);
    for(int i=mx+1;i<=16;i++)
    {
        l=max(l,getlen(a,b,i));
    }
    cout<<l;

    return 0;
}

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>

using namespace std;

char a[1000], b[1000];
int la, lb;
int n1, n2;
int mini;
int base;

int to10(char * cad, int l, int base) {
        int pot = 1;
        int n = 0;
        for (int i = l - 1; i >= 0; --i) {
                n += cad[i] * pot;
                pot *= base;
        }
        return n;

}

int cdi(int n, int b) {
        return log((long double) n) / log((long double) b) + 1;
}

int main() {

        mini = 0;
        scanf("%s %s", a, b);

        for (int i = 0; a[i] != 0; ++i) {

                a[i] = tolower(a[i]);

                if (a[i] <= '9') {
                        a[i] -= '0';
                } else
                        a[i] = a[i] - 'a' + 10;

                mini = max(mini, (int) a[i]);
                la = i;
        }
        la++;

        for (int i = 0; b[i] != 0; ++i) {
                b[i] = tolower(b[i]);
                if (b[i] <= '9') {
                        b[i] -= '0';
                } else
                        b[i] = b[i] - 'a' + 10;
                mini = max(mini, (int) b[i]);
                lb = i;
        }
lb++;
        base = mini + 1;
        //printf("BASE %d\n", base);
        n1 = to10(a, la, base);
        n2 = to10(b, lb, base);

        int res = n1 + n2;
        //printf("%d %d %d\n",res,n1,n2);
        printf("%d", cdi(res, base));
        return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <queue>
#include <memory.h>
#include <stack>

using namespace std;

#define pb push_back
#define mp make_pair
#define fir first
#define fi first
#define sec second
#define int64 long long
#define ld long double

const int inf=2000000000;

int n;

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b;
    scanf("%d %d",&a,&b);
    int x=a;
    int y=b;
    int max1=-1;
    int max2=-1;
    while (x!=0){
        max1=max(max1,x%10);
        x=x/10;
    }
    while (y!=0){
        max2=max(max2,y%10);
        y=y/10;
    }

    //a=a+b;
    int maxsz=-1;
    int max3=max(max1+1,max2+1);
    for (int j=max3;j<=3000;++j){
        int x=a;
        int y=b;
        int sz=0;
        int ost=0;
        while (x!=0 || y!=0){
            ost=(x%10)+(y%10)+ost;
            x=x/10;
            y=y/10;
            ++sz;
            ost=ost/j;
        }
        if (ost>0)++sz;
        maxsz=max(sz,maxsz);
    }
    printf("%d",maxsz);
}

#include <bits/stdc++.h>

using namespace std;
#define ll long long

int g(int x) {
    int ret = 0;
    while (x) {
        ret = max(ret, x % 10);
        x /= 10;
    }
    return ret;
}

int get(int n, int b) {
    int ret = 0;
    while (n) {
        ret++;
        n /= b;
    }
    return ret;
}

int conv(int a, int bas) {
    int ret = 0, cur = 1;
    while (a) {
        int dig = a % 10;
        a /= 10;
        ret += cur * dig;
        cur *= bas;
    }
    return ret;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int ma = max(g(a), g(b));
    ++ma;
    a = conv(a, ma);
    b = conv(b, ma);
    cout << get(a + b, ma) << endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
using namespace std;

int main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int a,b,a1,b1,max=0,u,d,res=0,j,tiv1[10]={0},y,tiv2[10]={0},i,ost,cur,ind,k;
	bool t;

	cin>>a>>b;

	a1=a;
	b1=b;

	while(a1 > 0)
	{
		if((a1%10) > max)
			max=a1%10;
		a1/=10;
	}

	while(b1 > 0)
	{
		if((b1%10) > max)
			max=b1%10;
		b1/=10;
	}

	max++;

	j=0;
	while(a > 0)
	{
		tiv1[j]=a%10;
		a/=10;
		j++;
	}

	i=0;
	while(b > 0)
	{
		tiv2[i]=b%10;
		b/=10;
		i++;
	}

	for(y=max;y<=20;y++)
	{
		ost=0;
		cur=0;
		ind=1;
		k=1;
		t=true;
		cur=(tiv1[0]+tiv2[0])/y;

		while(t)
		{

			if(k >= i && k >= j && cur == 0)
				t=false;

			cur=(cur+tiv1[k]+tiv2[k])/y;
			ind++;

			k++;
		}

		if(ind > res)
			res=ind;
	}

	cout<<res-1;
	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

void getMaxDigit(int n, int& m) {
	while (n > 0) m = max(m, n % 10), n /= 10;
}

int countDigits(int n) {
	int ans = 0;
	while (n > 0) n /= 10, ++ans;
	return ans;
}

int fromBase(int n, int b) {
	int k = 1, ans = 0;
	while (n > 0) ans += (n % 10) * k, k *= b, n/= 10;
	return ans;
}

int toBase(int n, int b) {
	string ans;
	while (n > 0) ans += ('0' + n % b), n /= b;
	reverse(ans.begin(), ans.end());
	return stoi(ans);
}

int main() {
	int a, b, x, y, z, i, mx = -1, ans = 0;
	cin >> a >> b;
	getMaxDigit(a, mx);
	getMaxDigit(b, mx);

	for (i = mx + 1; i <= 10; ++i) {
		x = fromBase(a, i);
		y = fromBase(b, i);
		z = toBase(x + y, i);
		ans = max(ans, countDigits(z));
	}

	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;

typedef long long int lld;

int main()
{
    string x , y ;
    cin >> x >> y ;
    int base = - 1 ;
    for (int i = 0 ; i < x.size() ; i++)
    {
        if (x[i] -48 > base)
        {
            base = x[i] - 48 ;
        }
    }
     for (int i = 0 ; i < y.size() ; i++)
    {
        if (y[i] -48 > base)
        {
            base = y[i] - 48 ;
        }
    }
    base++;
    string res ;

    while (x.size() < y.size())
        x.insert(x.begin() , '0');
    while (y.size() < x.size())
        y.insert(y.begin() , '0');

    int sum = 0 , carry = 0 ;
    for (int i = x.size() - 1 ; i >=  0 ; i--)
    {
        sum = x[i] -48 + y[i] -48 + carry;
        string temp ;
        while (sum > 0)
        {
            temp += (sum % base) +48 ;
            sum /= base;
        }
        reverse(temp.begin() , temp.end());

        int r = 0 ;
        for (int i = 0 ; i < temp.size() ; i++)
        {
            r+= temp[i] -48 ;
            if ( i < temp.size() - 1)
                r*=10;
        }
        sum = r % 10 ;
        carry = r / 10 ;
        //cout << sum << endl;
        res.insert(res.begin() ,  sum + 48);
    }

    if (carry)
        cout << res.size() + 1 << endl;
    else
        cout << res.size() << endl;

}

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ull unsigned long long
#define y1 asjdlfaskavslbcjasndscf
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter set< int >::iterator
#define iter1 multiset<int>::iterator
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1e6+7;
const int inf=1e9+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=4e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    if (mpos>=MAX_MEM){
//        cout<<"BAD"<<endl;
//        exit(0);
//    }
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

int get_ans(string s1,string s2)
{
    reverse(all(s1));
    reverse(all(s2));
    int m=max((int)s1.size(),(int)s2.size());
    ++m;
    while(s1.size()<m)s1+='0';
    while(s2.size()<m)s2+='0';
    vector<int>a1;
    vector<int>a2;
    int f=0;
    for (int i=0;i<m;++i){
        a1.pb(s1[i]-'0');
        a2.pb(s2[i]-'0');
        f=max(f,a1[i]);
        f=max(f,a2[i]);
    }
    ++f;
    for (int i=0;i<m-1;++i){
        a1[i]+=a2[i];
        a1[i+1]+=a1[i]/f;
        a1[i]%=f;
    }
    int mx=0;
    for (int i=0;i<m;++i){
        if (a1[i]!=0){
            mx=max(mx,i);
        }
    }
    ++mx;
    return mx;
}

main ()
{
    ios;
    string s1,s2;
    cin>>s1>>s2;
    cout<<get_ans(s1,s2)<<endl;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <cctype>
#include <cmath>
using namespace std ;
typedef long long ll ;
typedef pair<int,int> pii ;
const int maxn = 100000 + 5 , maxm = 1e6 + 5 , inf = 0x3f3f3f3f ;
const double eps = 1e-8 , pi = acos(-1.0) ;

int f( int a , int b , int k )
{
    int carry = 0 , ret = 0 ;
    while( a || b )
    {
        int dig = a % 10 + b % 10 + carry ;
        carry = dig / k ;
        dig %= k ;
        if( dig < 10 ) ret++ ;
        a /= 10 ; b /= 10 ;
    }
    if( carry ) ret++ ;
    return ret ;
}

int g( int n )
{
    int ret = 1 ;
    while( n )
    {
        ret = max( ret , n%10 ) ;
        n /= 10 ;
    }
    return ret+1 ;
}

int main()
{
    int a , b ;
    while( ~scanf( "%d%d" , &a , &b ) )
    {
        int ans = 0 , r = max( g(a) , g(b) ) ;
        for( int i = r ; i < 36 ; i++ ) ans = max( ans , f(a,b,i) ) ;
        printf( "%d\n" , ans ) ;
    }
    return 0 ;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fs first
#define sc second
#define sz size
#define ld long double
#define all(v) v.begin(),v.end()
#define MAX 9e18
#define MIN -9e18
const int MOD =1000000007;
const int N = 5010;
int solve(){
string a,b;
cin>>a>>b;
ll a_number=0,b_number=0;
ll mx=0;
ll n=a.sz(),m=b.sz();
for(ll i=0;i<n;i++){
  ll x=a[i]-'0';
  if(mx<x){
    mx=x;
  }
}
for(ll i=0;i<m;i++){
  ll x=b[i]-'0';
  if(mx<x){
    mx=x;
  }
}
ll base=mx+1;
ll pw=1;
for(ll i=n-1;i>=0;i--){
  a_number+=(a[i]-'0')*pw;
  pw*=base;

}
pw=1;
for(ll i=m-1;i>=0;i--){
  b_number+=(b[i]-'0')*pw;
  pw*=base;
}
a_number=a_number+b_number;
ll c=0;
while(a_number){
  c++;
  a_number/=base;
}
cout<<c<<endl;
return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
//   cin>>t;
    while(t--){

       solve();

    }

    return 0;

}

#include <stdio.h>
#include <stdlib.h>

#include <ctype.h>

#include <cmath>

#include <iostream>
#include <string>

using namespace std;

int getMaxDigit( int n )
{
	int maxDigit = 0;
	for(;;)
	{
		if ( n == 0 )
			break;
		const int d = n%10;
		if ( maxDigit < d )
			maxDigit = d;
		n /= 10;
	}
	return maxDigit;
}

int getDecByBase( int n, int b )
{
	int ret = 0;
	int bc = 1;
	for(;;)
	{
		ret += (n%10)*bc;
		n /= 10;
		bc *= b;
		if ( n == 0 )
			break;
	}
	return ret;
}

int getNumOfDigitsByBase( int n, int b )
{
	int d = 0;
	for(;;)
	{
		d++;
		n /= b;
		if (  n== 0 )
			break;
	}
	return d;
}

int main()
{

	int a, b;
	cin >> a >> b;

	int maxDigit = max( getMaxDigit( a ), getMaxDigit( b ) );

	const int digit = maxDigit+1;
	cout << getNumOfDigitsByBase( getDecByBase(a,digit)+getDecByBase(b,digit), digit ) << endl;

	return 0;
}

#include "bits/stdc++.h"

#define ll long long
#define ull unsigned long long
#define ld long double

#define tiii tuple < int, int, int >
#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >
#define pis pair < int, string >

#define vi vector < int >
#define vd vector < double >
#define vld vector < ld >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define vpi vector < pii >
#define vpll vector < pll >
#define vpis vector < pis >

#define pb push_back
#define mt make_tuple
#define gt0 get < 0 >
#define gt1 get < 1 >
#define gt2 get < 2 >

#define pi acos(-1)

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fast;

    int a, b;

    cin >> a >> b;

    int r = a, mx = 0;

    while(r) mx = max(mx, r % 10), r /= 10;

    r = b;

    while(r) mx = max(mx, r % 10), r /= 10;

    mx++;
    r = a;
    int sa = 0, sb = 0, p = 1;

    while(r) sa += (p * (r % 10)), p *= mx, r /= 10;

    r = b;
    p = 1;

    while(r) sb += (p * (r % 10)), p *= mx, r /= 10;

    r = (sa + sb);
    int sum = 0;

    while(r) sum++, r /= mx;

    cout << sum << endl;

    return 0;
}

#include <iostream>
using namespace std;

int sumbase(int base,int a,int b){
	int s = 0;
	if(a<b)
		swap(a,b);
	int q=0;
	int i=1;
	while(a!=0){
		s+=i*((q+a%10+b%10)%base);
		i*=10;
		q = (q+a%10+b%10)/base;
		a=a/10;b=b/10;
	}
	s+=i*((b+q)%base);
	q=(b+q)/base;
	s+=10*i*q;
	return s;
};
int minbase(int a){
	int max=0;
	while (a!=0){
		if (a%10>max)
			max=a%10;
		a=a/10;
	}
	return max+1;
};
int len(int a){
	int l=0;
	while (a!=0){
		a=a/10;
		l++;
	}
	return l;
};
int main(){
	int a,b;
	cin>>a>>b;
	cout<<len(sumbase(max(minbase(a),minbase(b)),a,b))<<endl;
	return 0;
}

#pragma GCC optimize("Ofast") // OPTIONAL: for faster execution
#include <bits/stdc++.h> // import everything in one shot
using namespace std;
// defines
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define invrep(i,b,a) for(int i = b; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedefs
typedef unsigned int uint;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
// -------------------------------

int max_digit(string& s) {
    int d = 0;
    for (char c : s) d = max(d, c-'0');
    return d;
}

int sum_length(string& a, string& b, int base) {
    int n = max(a.size(), b.size());
    int sum[n+1] = {0};
    rep(i,0,a.size()-1) sum[a.size()-1-i] += a[i]-'0';
    rep(i,0,b.size()-1) sum[b.size()-1-i] += b[i]-'0';
    int carry = 0;
    rep(i,0,n) {
        carry += sum[i];
        sum[i] = carry % base;
        carry /= base;
    }
    return (sum[n] == 0) ? n : n+1;
}

int main() {
    // OPTIONAL: for faster input/output (only if using cin/cout)
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string a, b;
    cin >> a >> b;
    int min_base = max(max_digit(a), max_digit(b))+1;
    int max_base = max(max_digit(a) + max_digit(b), min_base);
    int maxlen = 0;
    rep(base,min_base,max_base) {
        maxlen = max(maxlen, sum_length(a,b,base));
    }
    cout << maxlen << '\n';
    return 0;
}

#include <iostream>
#include <cctype>

using namespace std;

void change(char *s, int len)
{
	int i = 0, j = 4;
	for (i = len; i < 5; i++)
	{
		s[i] = '0';
	}

	for (i = len - 1; i >= 0; i--,j--)
	{
		s[j] = s[i];
		s[i] = '0';
	}

}

int c_num(char c)
{
	int tmp = 0;
	if (isupper(c))
	{
		tmp = c - 'A' + 10;
	}
	else
	{
		tmp = c - '0';
	}
	return tmp;

}

int adds(char *s1, char *s2,int base)
{
	int i = 0, c = 0,len;
	int num1 = 0, num2 = 0;
	for (i = 4; i >= 0; i--)
	{
		num1 = c_num(s1[i]);
		num2 = c_num(s2[i]);

		if (num1 + num2 + c > 0)
			len=5-i;
		if (num1 + num2 + c >= base)
		{
			c = 1;
		}
		else
		{
			c = 0;
		}

	}
	return len;
}

int main()
{
	int i = 0, base = 1;
	char s1[5] = { 0 }, s2[5] = {0};
	cin >> s1 >> s2;
	//printf("%s  %s\n", s1, s2);

	change(s1, strlen(s1));
	change(s2, strlen(s2));
	for (i = 0; i < 5; i++)
	{
		//printf("%d", s1[i]);
	}
	for (i = 0; i < 5; i++)
	{
		int tmp=c_num(s1[i]);

		if (tmp>=base)
		{
			base = tmp + 1;
		}

	    tmp = c_num(s2[i]);

		if (tmp >= base)
		{
			base =tmp + 1;
		}
	}
	//printf("%d", base);

	int len=adds(s1, s2,base);
	printf("%d", len);
	return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
using namespace std;

int sum[1010];

int main()
{
    int x,y;
    scanf("%d%d",&x,&y);
    int p=x;
    int max=0;
    int a,b;
    while(x>0)
    {
        a=x%10;
        if(a>max)
            max=a;
        x=x/10;
    }
    int q=y;
    while(y>0)
    {
        b=y%10;
        if(b>max)
            max=b;
        y=y/10;
    }
    max++;
    int flag=0,i=0;
    while(p!=0||q!=0)
    {
        sum[i++]=(p%10+q%10+flag)%max;
        flag=(p%10+q%10+flag)/max;
        p/=10,q/=10;
    }
    if(flag!=0)
        printf("%d\n",++i);
    else printf("%d\n",i);
}
/*2017-08-09 19:50:11.091*/

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>

using namespace std;

int maxNum(int a)
{
    int maxNum=0;
    int curNum;
    do
    {
        curNum=a%10;
        if(curNum>maxNum)
        {
            maxNum=curNum;
        }
        a/=10;
    }
    while(a!=0);

    return maxNum;
}

int len(int a)
{
    int l=0;
    do
    {
        l++;
        a/=10;
    }
    while(a!=0);

    return l;
}

int toDec(int a, int p)
{
    int res=0;
    int curp=1;
    while(a!=0)
    {
        res+=(a%10)*curp;
        a/=10;
        curp*=p;
    }
    return res;
}

int lenfromDec(int a, int p)
{
    int len=0;
    do
    {
        len++;
        a/=p;
    }
    while(a!=0);
    return len;
}

int max(int a, int b)
{
    if(a<b)
        return b;
    return a;
}

int main()
{
    int a,b;

    cin>>a>>b;

    int maxNa=maxNum(a);
    int maxNb=maxNum(b);
    int p=max(maxNa,maxNb)+1;

    int newA=toDec(a,p);
    int newB=toDec(b,p);
    int sum=newA+newB;

    int res=lenfromDec(sum,p);
    cout<<res<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1010;
int a, b, k, bn, ans, cnt, res[MAXN], a2[MAXN], b2[MAXN];

int main() {
	cin >> a >> b;
	while (a > 0) {
		if (a % 10 > bn)
			bn = a % 10;
		a2[cnt] = a % 10;
		cnt++;
		a /= 10;
	}
	cnt = 0;
	while (b > 0) {
		if (b % 10 > bn)
			bn = b % 10;
		b2[cnt] = b % 10;
		cnt++;
		b /= 10;
	}
	bn++;
	for (int i = 0; i < MAXN - 20; i++) {
		res[i] += (a2[i] + b2[i]) % bn;
		res[i + 1] += (a2[i] + b2[i]) / bn;
	}
	for (int i = 0; i < MAXN - 20; i++) {
		res[i + 1] += res[i] / bn;
		res[i] %= bn;
		if (res[i] > 0)
			ans = i;
	}
	cout << ans + 1 << '\n';
	return 0;
}

#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <numeric>
using namespace std;

int nextInt() {
	int x;
	scanf("%d", &x);
	return x;
}

int maxDigit(int x) {
	int r = -1;
	while (x > 0) {
		r = max(r, x % 10);
		x /= 10;
	}
	return r;
}

int toDec(int x, int base) {
	int r = 0;
	int p = 1;
	while (x > 0) {
		r += x % 10 * p;
		x /= 10;
		p *= base;
	}
	return r;
}

int main() {
	int a = nextInt();
	int b = nextInt();
	int base = max(maxDigit(a), maxDigit(b)) + 1;
	int x = toDec(a, base) + toDec(b, base);
	int res = 0;
	while (x > 0) {
		x /= base;
		++res;
	}
	cout << res << endl;
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int a[101],b[101],c[101],lena,lenb,len,x,y,base;
int main()
{
	scanf("%d%d",&x,&y);
	while(x)
	{
		a[++lena]=x%10;
		base=max(base,a[lena]);
		x/=10;
	}
	while(y)
	{
		b[++lenb]=y%10;
		base=max(base,b[lenb]);
		y/=10;
	}
	base++;
	len=max(lena,lenb);
	for(int i=1;i<=len;i++)
	{
		c[i]+=a[i]+b[i];
		c[i+1]+=c[i]/base;
		c[i]=c[i]%base;
	}
	while(c[len+1])
		++len;
	printf("%d",len);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
//KASRA FOULADI;
int log(int n, int m){
    int ans = 0;
    while(pow(m, ans) <= n)
        ++ans;
    return ans;
}

int main(){
    int n, m, num, cnt, base = 0;
    cin >> n >> m;
    num = n;
    while(num){
        base = max(base , (num % 10) + 1);
        num /= 10;
    }
    num = m;
    while(num){
        base = max(base , (num % 10) + 1);
        num /= 10;
    }
    cnt = 0;
    while(n){
        num += pow(base, cnt) * (n % 10);
        n /= 10;
        ++cnt;
    }
    cnt = 0;
    while(m){
        num += pow(base, cnt) * (m % 10);
        m /= 10;
        ++cnt;
    }
    cout << log(num, base) << '\n';
}

/***************************************
      zzblack                         **
      2015-09-01                      **
      Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef pair<int,int> pii ;
const int maxn = 1e5+50 ;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;

int get(int x) {
    int res = 0;
    while (x) {
        res = max(res, x % 10);
        x /= 10;
    }
    return res + 1;
}

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//      freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
#endif
    int a, b;
    cin >> a >> b;
    int d = max(get(a), get(b));
    int ans = 0, tmp = 0;
    while (a || b || tmp) {
        ans++;
        int t = a % 10 + b % 10 + tmp;
        if (t >= d) tmp = 1;
        else tmp = 0;
        a /= 10; b /= 10;
    }
    cout << ans << "\n" ;
	return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

typedef vector< int > vi;
typedef vector< vi > vii;
typedef vector< vii > viii;
typedef vector< int >:: iterator viit;

typedef long long int ll;

int min( int k)
{
    int r=0;
    do{
        if( r < k%10)
            r = k%10;

        k /=10;

    }
    while( k );
    return r;

}

int sum( int a, int b, int p)
{

    int res=0;
    int pp = 1;

    int carry=0;
    while( a || b || carry)
    {
        res += ((carry+a%10 + b%10)%p) * pp;
        pp *=10;
        carry = (carry+a%10 + b%10) >= p;

        a /=10;
        b /=10;

    }
    return res;
}

int main()
{
    int a,b,p,i,j;
    cin >> a >> b;

    int m;
    if( min(a) < min(b) )
        p = min(b);
    else
        p = min(a);

    p++;
    int s = sum( a,b,p);

    i=0;
    while( s )
    {
        i++;
        s /=10;
    }

    cout << i;

    //  system("pause");
    return 0;
}

#include <stdio.h>
#include <algorithm>
using namespace std;
#define nmax 10

int A[nmax], B[nmax];

int main ()
{
    int a, b, baza = 0;
    scanf("%d%d", &a, &b);
    while ( a )
    {
        ++A[0];
        A[A[0]] = a % 10;
        a = a / 10;
        baza = max(baza, A[A[0]]);
    }
    while ( b )
    {
        ++B[0];
        B[B[0]] = b % 10;
        b = b / 10;
        baza = max(baza, B[B[0]]);
    }
    baza ++;
    int i, t = 0;
    for (i = 1; i <= A[0] || i <= B[0] || t; i++, t/=baza)
    {
        A[i] = (t += A[i] + B[i]) % baza;
        A[0] = i - 1;
    }
    A[0] = 10;
    while ( !(A[A[0]]) ) A[0]--;
    //freopen("sum.out","w",stdout);
    printf("%d", A[0]);
    return 0;
}

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
string int_to_string(int x) {
    stringstream ss;
	ss << x;
	string ni = ss.str();
	return ni;
}
int main() {
	int a, b;
	cin >> a >> b;
	int p = 0;
	int y = a;
	int z = b;
	int maxm = 0;
	while (y) {
		maxm = max(maxm,y % 10);
		y /= 10;
	}
	while (z) {
		maxm = max(maxm,z % 10);
		z /= 10;
	}
	maxm++;
	string s1 = int_to_string(a);
	string s2 = int_to_string(b);
    int n = (int)s1.size();
    int m = (int)s2.size();
    int i = n - 1;
    int j = m - 1;
    int rem = 0;
    while (i >= 0 || j >= 0) {
		if (i < 0) {
			while (j >= 0) {
				p++;
				int x = s2[j] - '0' + rem;
				if (x >= maxm)rem = 1;
				else rem = 0;
				--j;
			}
			break;
		}
		if (j < 0) {
			while (i >= 0) {
				p++;
				int x = s1[i] - '0' + rem;
				if (x >= maxm)rem = 1;
				else rem = 0;
				--i;
			}
			//cout << p <<endl;
			break;
		}
		p++;
		int x = s1[i] - '0' + s2[j] - '0' + rem;
		if (x >= maxm) rem = 1;
		else rem = 0;
		--i;
		--j;
		//cout << rem << " " << x << " " << maxm <<  endl;
	}
	//cout << rem << endl;
	if (rem) p++;
	cout << p << endl;
}

//88
//9 8
 //7

#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#include <algorithm>
using namespace std;
int a, b, res;
vector<int> A, B;
int findMax(int n,vector<int> &v){
    int mx = 0;
    while (n){
        mx = max(mx, n % 10);
        v.push_back(n % 10);
        n /= 10;
    }
    return mx;
}
int calc(int b){
    vector<int> res(64);
    A.resize(64, 0);
    B.resize(64, 0);
    for (int i = 0; i < 62; ++i){
        res[i] += A[i] + B[i];
        res[i + 1] += res[i]/b;
        res[i] %= b;
    }
    for (int i = 63; i >= 0; --i)
        if (res[i])
            return i + 1;
    return 1;
}
int main()
{
    scanf("%d%d", &a, &b);
    for (int i = max(findMax(a,A), findMax(b,B)) + 1; i < 1024; ++i)
        res = max(res, calc(i));
    printf("%d\n", res);
    return 0;
}

#pragma warning (disable : 4996)

#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <assert.h>
#include <stack>
#include <algorithm>
#include <ios>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <sstream>
#include <map>
#include <memory.h>
#include <stdio.h>
#include <cassert>
#include <string.h>
#include <time.h>

#define forn(i , n) for (int i = 0; i < n; ++i)
#define down(i, n) for (int i = n - 1; i >= 0; --i)

using namespace std;

typedef unsigned long long int u64;
typedef long long i64;
typedef vector<i64> vint;
typedef vector<i64> vi64;
typedef pair<int, int> pint;
typedef pair<i64, i64> pi64;

#define FILE_NAME "file"
#define CONTEST "rmq"
#define M_PI 3.14159265358979323846
#define MODULE 1000000007

const i64 inf = 1000000000000000LL;

i64 get(i64 a, i64 d)
{
    string s;
    while(a)
    {
        s += a%10 + '0';
        a/= 10;
    }
    i64 ans = 0;
    down(i, s.length())
    {
        ans *= d;
        ans += s[i] - '0';

    }
    return ans;
}

string calc(i64 a, i64 d)
{
    string ans;
    while(a)
    {
        ans += (a % d) + '0';
        a/=d;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main()
{
    clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
    srand(13);
#ifdef FILE_INPUT
    freopen(FILE_NAME ".in", "r", stdin);
    freopen(FILE_NAME ".out", "w", stdout);
#endif
    string s1, s2;
    cin >> s1 >> s2;
    int d = max(*max_element(s1.begin(), s1.end()) + 1 - '0', *max_element(s2.begin(), s2.end()) + 1-'0');
    stringstream ss;
    ss << s1 << " " << s2;
    i64 a, b;
    ss >> a >> b;

    i64 a1 = get(a, d);
    i64 b1 = get(b, d);
    string ans = calc(a1 + b1, d);
    int l = ans.length();
    cout << max(l,1);
    return 0;
}

#include<bits/stdc++.h>

#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define pi pair<int,int>
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define SORT(v) sort(all(v))
#define UN(v) SORT(v), (v).erase(unique(all(v)),v.end())
#define common(a,b) SORT(a), SORT(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b) SORT(a), SORT(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())

#define FILL(a,d) memset(a,d,sizeof(a))
#define LL long long
#define ULL unsigned long long
#define DD double
#define PI 2*acos(0.0)

#define fr0(i,n) for(int i=0;i<n;i++)
#define fr1(i,n) for(int i=1;i<=n;i++)
#define fr(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)

#define ln puts("")

// for segment tree

#define eps 1e6
#define INF (1<<28)
#define mod 1000000007

/*FOR SEGMENT TREE*/
#define lft 2*idx
#define rgt lft+1

using namespace std;

// INPUT

void sf(int &x){scanf("%d",&x);}
void sf(LL &x){scanf("%lld",&x);}
void sf(float &x){scanf("%f",&x);}
void sf(double &x){scanf("%lf",&x);}
void sf(int &x,int &y){scanf("%d%d",&x,&y);}
void sf(float &x,float &y){scanf("%f%f",&x,&y);}
void sf(double &x,double &y){scanf("%lf%lf",&x,&y);}
void sf(double &x,double &y,double &z){scanf("%lf%lf%lf",&x,&y,&z);}
void sf(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sf(LL &x,LL &y,LL &z){scanf("%lld%lld%lld",&x,&y,&z);}
void sf(float &x,float &y,float &z){scanf("%u%u%u",&x,&y,&z);}
void sf(char &x){x=getchar();}
void sf(char *s){scanf("%s",s);}
void sf(string &s){cin>>s;}

// OUTPUT

void pf(int x) {printf("%d\n",x);}
void pf(int x,int y) {printf("%d %d\n",x,y);}
void pf(int x,int y,int z) {printf("%d %d %d\n",x,y,z);}
void pf(LL x) {printf("%lld\n",x);}
void pf(float x) {printf("%u\n",x);}
void pf(double x) {printf("%.6lf\n",x);}
void pf(double x,double y) {printf("%.5lf %.5lf\n",x,y);}
void pf(char x) {printf("%c\n",x);}
void pf(char *x) {printf("%s\n",x);}
void pf(string x) {cout<<x; ln; }

template<class T> T bigmod(T b,T p,T m){if(p==0) return 1%m; T x=b; T ans=1; while(p){ if(p&1) ans=(ans*x)%m; p>>=1; x=(x*x)%m; } return ans; }
template<class T> T gcd(T x, T y){if (y==0) return x; return gcd(y,x%y);}
template <typename T> T POW(T b,T p) { if (p == 1) return b; if (p%2 == 0) { T s = POW(b,p/2); return s*s; } return b*POW(b,p-1);}
template <typename T> T modinv(T num,T m) {return bigmod(num,m-2,m);}

int mn(int a,int b){
    int an=0;
    while(a){
       an=max(an,a%10);
       a/=10;
    }
    while(b){
       an=max(an,b%10);
       b/=10;
    }
    return an;
}

int main()
{
   int a,b; sf(a,b);
   int c=mn(a,b);
   c++;
  // pf(c); ln;
   int an=0,r=0;
   while(a || b){
       int d=a%10;
       int e=b%10;
       d+=e+r;
       if(d>=c) r=1;
       else r=0;
       an++;
       a/=10;
       b/=10;
   }
   if(r) an++;
   pf(an);
    return 0;
}

#include <iostream>
using namespace std;

int power(int a, int b){
    if(b==0){
        return 1;
    }

    int result = 1;

    for(int i=1; i<=b; i++){
        result = result*a;
    }

    return result;
}

int digit_in_number(int a, int b){
    int result=0;

    while(a!=0){
        result++;
        a=a/b;
    }
    return result;
}

int toDec(int a, int b){
    int result = 0, i=0;
    //cout<<a<<"   "<<b<<endl;

    while(a!=0){
        result += (a%10)*power(b, i);
        i++;
        a=a/10;
        //cout<<result<<endl;
    }
    return result;
}

int main(){
    int a, b, base=0, c;
    cin>>a>>b;

    c=a;
    while(c!=0){
        if(c%10 > base){
            base = c%10;
        }
        c=c/10;
    }
    c=b;
    while(c!=0){
        if(c%10 > base){
            base = c%10;
        }
        c=c/10;
    }

    int dec_a = toDec(a, base+1);
    int dec_b = toDec(b, base+1);

    ///cout<<dec_a<<"   "<<dec_b<<endl;

    cout<<digit_in_number(dec_a+dec_b, base+1);

    return 0;
}

//________-_-_-_-_-_-________//
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long

int32_t main() {
    fast;
    int a, b, base = 2;
    cin >> a >> b;
    for(char c : to_string(a)) {
        base = max(base, (int)(c-'0')+1);
    }
    for(char c : to_string(b)) {
        base = max(base, (int)(c-'0')+1);
    }
    int deca = 0, decb = 0, po = 1;
    while(a > 0) {
        deca += (a%10)*po;
        po *= base;
        a /= 10;
    }
    po = 1;
    while(b > 0) {
        decb += (b%10)*po;
        po *= base;
        b /= 10;
    }
    int ans = deca + decb, cnt = 0;
    while(ans > 0) {
        cnt++;
        ans /= base;
    }
    cout << cnt << endl;
}

#include<bits/stdc++.h>
using namespace std;
int P,A,B,a[10],b[10],c[10],len,la,lb;
inline int read(){
	int x=0,f=1;char C=getchar();
	while(!isdigit(C)) {if(C=='-') f=-1;C=getchar();}
	while(isdigit(C)) {
		x=(x<<1)+(x<<3)+C-'0';
		P=max(P,C-'0');
		C=getchar();
	}
	return x*f;
}
inline void work(){
	while(A) a[++la]=A%10,A/=10;
	while(B) b[++lb]=B%10,B/=10;
	len=max(la,lb);
	for(int i=1;i<=len;i++)
	c[i]+=a[i]+b[i],c[i+1]+=c[i]/P,c[i]%=P;
	while(c[len+1]>0) len++;
	printf("%d\n",len);
}
int main(){
	A=read(),B=read(),P++;
	work();
	return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <queue>
#include <memory.h>
#include <stack>

using namespace std;

#define pb push_back
#define mp make_pair
#define fir first
#define fi first
#define sec second
#define int64 long long
#define ld long double

const int inf=2000000000;

int n;

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b;
    scanf("%d %d",&a,&b);
    int x=a;
    int y=b;
    int max1=-1;
    int max2=-1;
    while (x!=0){
        max1=max(max1,x%10);
        x=x/10;
    }
    while (y!=0){
        max2=max(max2,y%10);
        y=y/10;
    }

    //a=a+b;
    int maxsz=-1;
    int max3=max(max1+1,max2+1);
    for (int j=max3;j<=3000;++j){
        int x=a;
        int y=b;
        int sz=0;
        int ost=0;
        while (x!=0 || y!=0){
            ost=(x%10)+(y%10)+ost;
            x=x/10;
            y=y/10;
            ++sz;
            ost=ost/j;
        }
        if (ost>0)++sz;
        maxsz=max(sz,maxsz);
    }
    printf("%d",maxsz);
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string a, b; cin >> a >> b;

    int maxi = 0;
    for(int i = 0; i < a.size(); ++i)
        maxi = max(maxi, a[i]-'0');
    for(int i = 0; i < b.size(); ++i)
        maxi = max(maxi, b[i]-'0');
    maxi++;

    string ans = "";
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());

    a.resize(max(b.size(), a.size()) + 1, '0');
    b.resize(a.size(), '0');

    for(int i = 0; i < a.size() - 1; ++i)
    {
        ans += '0' + ((a[i]-'0') + (b[i]-'0')) % maxi;
        a[i+1] += ((a[i]-'0') + (b[i]-'0')) / maxi;
    }
    ans += a.back();
    while(ans.back() == '0')
        ans.pop_back();

    cout << ans.size();
}

#include <iostream>
#include <cstdio>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	string a, b;
	cin>>a>>b;
	int mx = -1;
	for (int i=0; i<a.length(); i++)
		if (a[i]-'0'>mx) mx = a[i]-'0';
	for (int i=0; i<b.length(); i++)
		if (b[i]-'0'>mx) mx = b[i]-'0';
    mx++;
	vector<int> res;
	int len = max(a.length(), b.length())+1;
	int pr = 0;
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	for (int i=0; i<len; i++){
		int aa, bb;
		if(i >= a.length()) aa = 0;
		else aa = a[i]-'0';
		if(i >= b.length()) bb = 0;
		else bb = b[i]-'0';

		int c = aa+bb+pr;
		res.push_back(c%mx);
		pr = c/mx;
	}
	int ans = res.size();
	if(!res[ans-1]) ans--;
	cout<<ans;

	return 0;
}

#include <iostream>
#include <stdlib.h>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

#define MAX(a, b) (a > b ? a : b)

int getMaxDigit(int n)
{
    char str[5];
    sprintf(str, "%d", n);

    int maxDigit = 0;

    for (int i = 0; i < strlen(str); i++)
    {
        maxDigit = MAX(str[i] - '0', maxDigit);
    }

    return maxDigit;
}

int getNumberToBase10(int n, int base)
{
    char str[5];
    sprintf(str, "%d", n);

    int number = 0;

    for (int i = 0; i < strlen(str); i++)
    {
        number = number * base + (str[i] - '0');
    }

//    for (int i = strlen(str) - 1; i >= 0; i--)
//    {
//        number += (str[i] - '0') * pow(base, strlen(str) - 1 - i);
//        78(9)  = 71(10)
//        87(9)  = 79(10)
//        150(10) = 176(9)
//    }

    return number;
}

int getDigitsForBase(int n, int base)
{
    int count = 0;

    do
    {
        count++;
//        c out << n % base;
        n = n / base;
    } while (n);

    return count;
}

int main()
{
    int a = 0;
    int b = 0;

    cin >> a >> b;

    int minBase = MAX(getMaxDigit(a), getMaxDigit(b)) + 1;
//    cout << "min base: " << minBase << endl;
//    cout << "a: " << getNumberToBase10(a, minBase) << endl;
//    cout << "b: " << b << ", " << getNumberToBase10(b, minBase) << endl;
    cout << getDigitsForBase(getNumberToBase10(a, minBase) + getNumberToBase10(b, minBase), minBase) << endl;

    return 0;
}

#include<iostream>
#include<cmath>
using namespace std;

int no_of_digits(string a,string b,int base)
{
	int A=0,B=0,j=0;

	// for(int i=a.length()-1;i>=0;i--)
	// 	A+=(a[i]-'0')*pow(base,j++);

	// j=0;
	// for(int i=b.length()-1;i>=0;i--)
	// 	B+=(b[i]-'0')*pow(base,j++);

	//OR
	for(int i=0;i<a.length();i++)
		A=A*base+a[i]-'0';

	for(int i=0;i<b.length();i++)
		B=B*base+b[i]-'0';

	int num=A+B,digits=0;
	while(num>0)
	{
		digits++;
		num/=base;
	}
	return digits;
}

int main()
{
	string a,b;
	int maximum=1,ans=0;
	cin>>a>>b;

	for(int i=0;i<a.length();i++)
		maximum=max(maximum,a[i]-'0');

	for(int i=0;i<b.length();i++)
		maximum=max(maximum,b[i]-'0');

	for(int i=maximum+1;i<200;i++)
		ans=max(ans,no_of_digits(a,b,i));

	cout<<ans;
	return 0;
}

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#define maxn 200
using namespace std;
int getmaxnum(int x)
{
    int max=0;
    while(x)
    {
        int s=x%10;
        if(s>max) max=s;
        x/=10;
    }
    return max;
}
int change(int x,int base)
{
    int s=0,p=1;
    while(x)
    {
        s+=x%10*p;
        x/=10;
        p*=base;
    }
    return s;
}
int main()
{
    int a,b;
    cin>>a>>b;
    int base=max(getmaxnum(a),getmaxnum(b))+1;
    int sum=change(a,base)+change(b,base);
    int j=0;
    while(sum)
    {
        int s=sum%base;
        sum/=base;
        j++;
    }
    cout<<j<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define all(B) (B).begin(), (B).end()
#define sz(B) (B).size()
#define pb push_back
#define mp make_pair
#define sc second
#define fr first

typedef long long ll;
typedef pair<ll , ll> pll;
typedef pair<int , int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;

const int MAX = 1e5 + 10;
const int inf = 2e9 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-15;

ll kok(ll v){
      ll mn = 0;
      while(v)mn = max(v % 10, mn), v /= 10;
      return mn;
}

ll doi(ll v, ll si){
      ll pw = 1, res = 0;

      while(v){
            res += pw * (v % 10);
            v /= 10;
            pw *= si;
      }

      return res;
}

int iod(ll v, ll si){
      int cnt = 0;
      while(v){
            v /= si;
            ++cnt;
      }
      return cnt;
}

ll a, b;

int main(){
      cin >> a >> b;

      ll si = max(kok(a), kok(b)) + 1;

      ll res = doi(a, si) + doi(b, si);

      cout << iod(res, si);
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int m(int a, int b) {
	int res = 0;
	while (a || b) {
		res = max(res, a % 10);
		res = max(res, b % 10);
		a /= 10;
		b /= 10;
	}
	return res + 1;
}

int cnt(int a, int b) {
	int res = 0;
	while (a || b) {
		res++;
		a /= 10;
		b /= 10;
	}
	return res;
}

int main() {
	#ifdef LOCAL
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	int n = m(a, b);
	int p = 0;
	int c = cnt(a, b);
	while (a || b) {
		p = ((a % 10) + (b % 10) + p) / n;
		a /= 10;
		b /= 10;
	}
	if (p) cout << c + 1;
	else cout << c;
	return 0;
}

    #include <iostream>
    #include <string>
    #include <algorithm>
    #include <vector>
    #define pb push_back
    using namespace std;

    string a, b;
    int ans = 0, mx = -1;
    vector<int> v[2];

        int tod(int id,int k){
            int p = 1,sm = 0;
                for(int i=v[id].size()-1; i>=0; i--){
                        sm += v[id][i]*p;
                       // cout << p << " " << v[id][i] << endl;
                        p *= k;
                }
               // cout << k << " " << sm << endl;
            return sm;
        }

        int tok(int a,int k){
            vector<int> f;
            while(a!=0){
                        int uy = a%k;
                        f.pb(uy);
                        a/=k;
            }
            return f.size();
        }

    int main(){

        cin >> a >> b;

        for(int i=0; i<a.size(); i++){
                mx = max(mx,a[i]-48);
                v[0].pb(a[i]-48);
        }
        for(int i=0; i<b.size(); i++){
                mx = max(mx,b[i]-48);
                v[1].pb(b[i]-48);
        }
        /*
        reverse(v[0].begin(),v[0].end());
        reverse(v[1].begin(),v[1].end());
        */
        int k = mx+1;

                ans = tok( tod(0,k)+tod(1,k),k );

        cout << ans;

  //     system("PAUSE");
        return 0;
    }

#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <fstream>
#include <string>
#include <memory>
#include <utility>
#include <ctype.h>
#include <cstdlib>
#include <cassert>
#include <cstring>
using namespace std;
#define MIN(a,b)  (((a)<(b)) ? a : b)
#define MAX(a,b)   (((a)>(b)) ? a : b)
#define SUM(a,b,c)  (a+b+c)
#define MUl(a,b) a*b
#define Div(a,b) a/b
#define LO(i,n)   for(i=0;i<(int)n;i++)
#define LO3(i,a,b)      for(int i=(a);i<=(b);i++)
#define LOS(i,s)    for (int i=0;i<s.size();i++)
#define LO1(i,s)    for (int i=0;i<s.size();i++)
#define LOV(i,v)   for (int i=0;i<v.size();i++)
#define wh(a)   while (a--)
#define EN(n)      cin>>n;
#define EN2(n,m)     cin>>n>>m;
#define EN3(n,m,k)      cin>>n>>m>>k;
#define cout(a,b,c)       cout<<a<<" "<<b<<" "<<c;
#define cout(a,b)   cout<<a<<" "<<b<<endl;
#define cout(a)  cout<<a<<endl;
#define pb push_back
#define c(a,b)  a%=b;
#define d(a,b)  b%=a;
#define GCD(a,b)
#define SORT(v)  sort(v.begin(),v.end())
#define SZ(X) (int)(X).size()
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define R  return 0;
#define up ceil
#define down floor
#define N  100001
typedef long long ll;
typedef vector<int> integr;
typedef vector<char> character;
typedef vector <int> strings;
int d[N],d1[N];
//long long  n,j=0,c,k,cf=0,Max,t;
//long long v[101];
int base=0;
 void getbase(int a)
 {
     while(a)
     {
         int f=a%10;
         if (base<f)base=f;
         a=a/10;
     }

 }
int getlen(int a,int b,int ba)
{
    int l=0,c=0,r;
    while(a||b||c)
    {
        r=c;
       if(a!=0)
       {
           r+=a%10;
           a=a/10;
       }
       if(b!=0)
       {
           r+=b%10;
           b=b/10;
       }
       c=r/ba;
       l++;
    }
      return l;
}
int  main ()
{
int a,b;
cin>>a>>b;
getbase(a);
getbase(b);
I length1=0;
for (int i=base+1;i<=16;i++){
 length1=max(length1,getlen(a,b,i));
}
 cout<<length1<<endl;

  R
}

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll __int64
#define ls rt<<1
#define rs ls|1
#define lson l,mid,ls
#define rson mid+1,r,rs
#define middle (l+r)>>1
#define clr_all(x,c) memset(x,c,sizeof(x))
#define clr(x,c,n) memset(x,c,sizeof(x[0])*(n+1))
#define eps (1e-8)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define PI (acos(-1.0))
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T> T _max(T x,T y){return x>y? x:y;}
template <class T> T _min(T x,T y){return x<y? x:y;}
template <class T> T _abs(T x){return (x < 0)? -x:x;}
template <class T> T _mod(T x,T y){return (x > 0)? x%y:((x%y)+y)%y;}
template <class T> void _swap(T &x,T &y){T t=x;x=y;y=t;}
template <class T> void getmax(T& x,T y){x=(y > x)? y:x;}
template <class T> void getmin(T& x,T y){x=(x<0 || y<x)? y:x;}
int TS,cas=1;
const int M=100000+5;
int n,m;
int a[11],b[11],c[11];

void run(){
    int i,j;
    int bas=0;
    int la=0,lb=0;
    while(n) bas=_max(bas,a[la++]=n%10),n/=10;
    while(m) bas=_max(bas,b[lb++]=m%10),m/=10;
    bas+=1;
    int ret=0;
    for(i=0,j=0;i<la || i<lb;i++){
        int tmp=j+b[i]+a[i];
        c[ret++]=tmp%bas;
        j=tmp/bas;
    }
    while(j) ret++,j/=bas;
    printf("%d\n",ret);
}

void preSof(){
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    preSof();
    //run();
    while((~scanf("%d%d",&n,&m))) run();
    //for(scanf("%d",&TS);cas<=TS;cas++) run();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int a,b, mx;
string s1, s2;
char* itoa(int val, int base){
    static char ans[50] = {0};
    int i = 40;
    for(; val && i ; --i, val /= base)
    	ans[i] = "0123456789abcdef"[val % base];
    return &ans[i+1];
}
int main(){
  	ios::sync_with_stdio(false);
    cin >> s1 >> s2;
  	for(int i = 0; i < s1.size(); ++i)
      	mx = max(mx, s1[i]-'0');
   for(int i = 0; i < s2.size(); ++i)
      	mx = max(mx, s2[i]-'0');
  	a = strtol(s1.c_str(), NULL, mx+1);
    b = strtol(s2.c_str(), NULL, mx+1);
    cout << strlen(itoa(a+b, mx+1)) << endl;
}

#include <cstdio>

int Len(int a,int b,int p) {
    int x=0,y=0,q=1;
    while (a) {
        x+=q*(a%10);
        a/=10;
        q*=p;
    }
    q=1;
    while (b) {
        y+=q*(b%10);
        b/=10;
        q*=p;
    }
    int r=0,s=x+y;
    while (s) {
        r++;
        s/=p;
    }
    return r;
}

int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    int d=0,A=a,B=b;
    while (a) {
        if ((a%10)>d)
            d=a%10;
        a/=10;
    }
    while (b) {
        if ((b%10)>d)
            d=b%10;
        b/=10;
    }
    int res=-1;
    for (int i=d+1; i<=16; i++) {
        int tmp=Len(A,B,i);
        if (tmp>res)
            res=tmp;
    }
    printf("%d\n",res);
    return 0;
}

    // every champion was once a contender who refused to give up //
    // eat sleep code repeat :)
    // vectorTango
    // reapedJuggler

    #include "bits/stdc++.h"

    #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define ll long
    #define all(A) begin(A) , end(A)
    #define For(i , n)  for(ll int i = 0; i < n ; i++)
    #define For1(i , n) for(ll int i = n - 1; i >= 0 ; i++)
    #define lld long long
    #define ull unsigned long long
    #define input ll int*a = new ll int[n]
    #define input1 ll int*b = new ll int[n]
    #define vec vector <ll int>
    #define pb push_back
    #define ss second
    #define ff firstw
    #define maxn 10000123
    #define mod 1000000007
    #define mpp make_pair
    #define finish(x) cout << v << " ";
    #define tolower(s)   std::transform(s.begin(), s.end(), s.begin(),[](unsigned char c){ return std::tolower(c); });

    using namespace std;

    void start()
    {
      #ifndef ONLINE_JUDGE
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
    }

    vec g[200007];
    map<ll int , bool> vis ; ll int siz = 0;

    void dfs(ll int x){
     // ll int cmp = 0 ; double ans = 0.0;
     vis[x] = 1;
     siz++;
     for(auto i : g[x]){
      if(!vis[i]){

        dfs(i);
      }
     }
     return ;
    }

  // ll int pow1(ull int a , ll int y){
  //   // a %= mod;
  //   ull int res = 1;

  //   while(y > 0){

  //     if(y & 1)
  //       res = (res*a)%mod;

  //     y = y >> 1;
  //     a = (a*a)%mod;
  //   }
  //   return res;
  // }

  ll int base(ll int a){
    ll int ans = 0;
    while(a > 0){
      ans = max(ans , a % 10);
      a /= 10;
    }
    return ans;
  }

  void sober(){
    ll int n , k = 0; string s;
    cin >> n >> k;
    ll int maxx = max(base(n) , base(k)) + 1;
    ll int ans = 0;
    ll int temp = 0;
    ll int c = 0;
    while(n > 0){
      temp += pow(maxx , c++)*(n % 10);
      n /= 10;

    }
    c = 0;
    // cout << temp << "\n";
    while(k > 0){
      temp += pow(maxx , c++)*(k % 10);
      k /= 10;
    }
    // cout << temp << "\n";
    while(temp > 0){
      temp /= maxx;
      ans++;
    }
    cout << ans << "\n";
    return ;
  }

    signed main(){
      start();
      FAST_IO;
      ll int t = 1;
      // cin >> t;
      while(t--){
         sober();
      }
     }

    //  c0ded by :
    // - - - - - - - - - - - - - - - - - - - - - - s 0 b e r

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int a, b, ares = 0, k, carry = 0, x, res = 0, flag;
	cin >> a >> b;
	k = a;
	while(k)
		(ares < k % 10? ares = k % 10, k /= 10: k /= 10);
	k = b;
	while(k)
		(ares < k % 10? ares = k % 10, k /= 10: k /= 10);
	ares++;
	flag = 1;
	carry = 0;
	while(flag != 0 || carry != 0 || a != 0 || b != 0) {
		x = a % 10 + b % 10 + carry;
		flag = x % ares;
		carry = x / ares;
		a /= 10, b /= 10;
		res++;
	}
	cout << res - 1 << endl;
	return 0;
}

#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int base;
struct BigInt
{
    int a[10000];
    int l;
    BigInt () {memset (a, 0, sizeof(a));}
    BigInt (int x)
    {

        memset (a, 0, 1000);
        l=0;
        a[0]=x;
        for (l=0; a[l]!=0; ++l)
        {
            a[l+1]=a[l]/base;
            a[l]%=base;
        }
    }
    void print ()
    {
        if (l==0)
            printf ("0");
        int i=l;
        for (i=l-1; i>=0; i--)
        {
            printf("%d", a[i]);
        }
    }
    BigInt operator+(const BigInt &b)
    {
        BigInt res;
        int i;
        for (i=0; i<=l || i<=b.l; i++)
        {
            res.a[i+1]=(res.a[i]+a[i]+b.a[i])/base;
            res.a[i]=(res.a[i]+a[i]+b.a[i])%base;
        }
        for (i=l+b.l; i>=0; i--)
        {
            if (res.a[i]!=0)
                break;
        }
        res.l=i+1;
        return res;
    }
	BigInt operator-(const BigInt &b)
	{
		BigInt res;
        int i;
		for(i=0;i<l;i++)
		{
			if(res.a[i]+a[i]>=b.a[i])
				res.a[i]=res.a[i]+a[i]-b.a[i];
			else
			{
				res.a[i+1]--;
				res.a[i]=res.a[i]+a[i]-b.a[i]+10;
			}
		}
        for (i=l; i>=0; i--)
        {
            if (res.a[i]!=0)
                break;
        }
        res.l=i+1;
        return res;
	}
    void scan()
    {
        int i=0;
        char c=2;
        while (c!='\n' && c!=' ' && c!= EOF)
        {
            c=getchar ();
            if (c=='\n' || c==' ' || c==EOF)
                break;
            a[i]=c-48;
            i++;
        }
        reverse (a, a+i);
        l=i;
    }
    BigInt operator*(int b)
    {
        BigInt res;
        int i;
        for(i=0;i<=l+1;i++)
        {
            res.a[i]+=a[i]*b;
            res.a[i+1]=(res.a[i])/base;
            res.a[i]%=base;
        }
        for (i=l+2; i>=0; i--)
        {
            if (res.a[i]!=0)
                break;
        }
        res.l=i+1;
        return res;
    }
	bool operator>=( const BigInt &b)
	{
		int i;
		if(l>b.l)
			return true;
		if(b.l>l)
			return false;
		for(i=l-1;i>=0;i--)
		{
			if(a[i]>b.a[i])
				return true;
			if(b.a[i]>a[i])
				return false;
		}
		return true;
	}
	int step()
	{
		int j,k=0;
		for(j=2;j<=9;j++)
		{
			for(int i=0;i<l;i++)
			{
				if(a[i]>=j)
					k=-1;
			}
			if(k!=-1)
			break;
			k=0;
		}
		return j;
	}
};
char a[100];
int main()
{
	int i,j,n,s,l;
	BigInt a,b;
	a.scan();
	b.scan();
	base=max(a.step(), b.step());
	a=a+b;
	//a.print();
	//printf("\n");
	//printf("%d", base);
	printf("%d", a.l);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){

   int a, b, c, d, p=0, i, q=0;
   cin>>a>>b;
   double x, y, v, kk;
    c=a;
    d=b;
   while(a)
   {
        i=a%10;
        p=max(p, i);
        a/=10;
   }
   while(b)
   {
       i=b%10;
       p=max(p, i);
       b/=10;
   }
   p++;
    int carry=0, len=0;;
    while(c>0 || d>0 || carry>0)
    {
        carry=(c%10 + d%10 + carry)/p;
        c/=10;
        d/=10;
        len++;
    }

    cout<<len<<endl;

}

#include<cstdio>
#include<algorithm>
using namespace std;
int maxn=0, a[50]={0}, m ,n, t=0;
int main( )
{
    scanf("%d %d", &m, &n);
    while(m||n)
    {
        a[t++]=m%10+n%10;
        maxn=max(m%10, max(n%10, maxn));
        m/=10, n/=10;
    }
    maxn++;
    for(int i=0; i<t; i++)
        if(a[i]>=maxn)
            a[i+1]+=a[i]/maxn, a[i]%=maxn;
    if(a[t]<maxn&&a[t]>0)
        t++;
    else if(a[t]>=maxn)
        t+=2;
    printf("%d\n", t);
}

#include <bits/stdc++.h>
using namespace std;

void DBG() { cerr << endl; }
template<typename Head, typename... Tail>
void DBG(Head H, Tail... T) { cerr << ' ' << H; DBG(T...); }
#define dbg(...) cerr << "(" << (#__VA_ARGS__) << "):", DBG(__VA_ARGS__)

typedef long long ll;
typedef long double ld;

#define siz(a) int(a.size())
#define ints(a...) int a; read(a)
#define all(a) a.begin(), a.end()  // [i, n) => i + all(v)  |  [0, i) => all(v) - n + i
#define rall(a) a.rbegin(), a.rend()
#define rep(i, b, n) for (int i = b; i < n; i++)  // rep(i, start, n + start) => total 'n' length traverse
#define per(i, b, n) for (int i = b; i >= n; i--) // [b, n]

template<typename... Args>
inline void read(Args&... args) { ((cin >> args), ...); }
template<typename... Args>
inline void show(Args... args) { ((cout << args << " "), ...); }
template<typename T>
inline void operator>> (istream& in, vector<T>& v) { rep(i, 0, siz(v)) in >> v[i]; }
template<typename T>
inline void operator<< (ostream& out, const vector<T>& v) { rep(i, 0, siz(v)) out << v[i] << " \n"[i + 1 == siz(v)]; }
template<typename... Args>
inline auto create(size_t n, Args&&... args) { if constexpr(sizeof...(args) == 1) return vector(n, args...); else return vector(n, create(args...)); }

const int MOD = 1e9 + 7;

int64_t pow_n(int64_t a, int p) {
    int64_t ans = 1;
    while (p) {
        if (p & 1) ans *= a;
        a = a * a;
        p >>= 1;
    }
    return ans;
}

int64_t getDecimal(int64_t a, int base) {
    int64_t b = 0, i = 0;
    while (a) {
        b += a % 10 * pow_n(base, i++);
        a /= 10;
    }
    return b;
}

vector<int> convert(int64_t a, int base) {
    vector<int> v;
    while (a) {
        v.emplace_back(a % base);
        a /= base;
    }
    reverse(v.begin(), v.end());
    return v;
}

void solve() {
    ints(a, b);
    string s = to_string(a);
    int mn = -1;
    while (!s.empty())
        mn = max(mn, (int)s.back()),
        s.pop_back();
    s = to_string(b);
    while (!s.empty())
        mn = max(mn, (int)s.back()),
        s.pop_back();

    mn = mn - '0' + 1;
    a = getDecimal(a, mn), b = getDecimal(b, mn);
    int c = a + b;
    auto v = convert(c, mn);
    cout << siz(v);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
    int T = 1;
    // cin >> T;
    while (T--) solve();
    return 0;
}

#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <list>
#include <fstream>
#define ull unsigned long long
#define ll long long
#define ld long double
#define pi 3.1415926536
#define lp(i,n,a) for(ll i=a;i<=n;i++)
#define pl(i,n) for(ll i=n-1;i>=0;i--)
#define w while
#define re return
// Hard Training :D
// hossam yehia //
using namespace std;
ll n, m, maxi, a, b, f, out;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	a = n, b = m;
	while (a)
		maxi = max(maxi, (a % 10)),a /= 10;
	while (b)
		maxi = max(maxi, (b % 10)),b /= 10;
	maxi++;
	while (n || m || f) {
		f += (n % 10) + (m % 10);
		f /= maxi;
		n /= 10, m /= 10;
		out++;
	}
	cout << out << endl;
	cin >> n;
	re 0;
}

#include <cstdio>
#include <cstring>

const int MAXN = 1100;

int x, y, n1[MAXN], n2[MAXN], n3[MAXN];
char a[MAXN], b[MAXN];

int main() {

    scanf("%s %s", a, b);
    int base = 2;
    for (int i = 0; i < (int)strlen(a); i++) {
        if (a[i] - '0' > base - 1) base = a[i] - '0' + 1;
    }
    for (int i = 0; i < (int)strlen(b); i++) {
        if (b[i] - '0' > base - 1) base = b[i] - '0' + 1;
    }
    sscanf(a, "%d", &x);
    sscanf(b, "%d", &y);

    int l1 = strlen(a);
    for (int i = 0; i < l1; i++) n1[i] = a[l1 - i - 1] - '0';

    int l2 = strlen(b);
    for (int i = 0; i < l2; i++) n2[i] = b[l2 - i - 1] - '0';

    for (int i = 0; i <= l1 || i <= l2; i++) {
        n3[i] += n1[i] + n2[i];
        n3[i + 1] = n3[i] / base;
        n3[i] %= base;
    }
    for (int i = 1000; i >= 0; i--)
        if (n3[i]) {
            printf("%d\n", i + 1);
            return 0;
        }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)

string sa, sb;

int main()
{
    cin >> sa >> sb;

    int base = 0;
    for (char c : sa) base = max(base, c - '0' + 1);
    for (char c : sb) base = max(base, c - '0' + 1);

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

    int ans = 0, prev = 0;
    while (a + b + prev)
    {
        prev = (a % 10 + b % 10 + prev) / base;
        a /= 10; b /= 10;
        ans++;
    }

    cout << ans << '\n';
}

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <string>
#include <string.h>
#include <unordered_map>
#include <vector>

typedef long long LL;

int IntMaxVal = (int) 1e20;
LL LongMaxVal = (LL) 1e20;

#define FOR(i, a, b) for(int i = a; i < b ; ++i)
#define FORD(i, a, b) for(int i = a; i >= b; --i)

#define minimize(a, b) { a = min(a, b); }
#define maximize(a, b) { a = max(a, b); }

#define next(type, i) type i; cin >> i;
template<typename T> struct argument_type;
template<typename T, typename U> struct argument_type<T(U)> { typedef U type; };
#define nextVector(t, v, size) vector< argument_type<void(t)>::type > v(size); { for (int i = 0 ; i < size ; i++) cin >> v[i]; }

using namespace std;

istream& operator>>(istream& is, pair<int, int>& s)
{
    is >> s.first >> s.second;
    return is;
}

int main() {
    ios_base::sync_with_stdio(false);

    next(int, a);
    next(int, b);

    int base = 0;
    int tmp = a;
    while (tmp > 0) {
    	maximize(base, tmp % 10);
    	tmp /= 10;
    }
    tmp = b;
    while (tmp > 0) {
    	maximize(base, tmp % 10);
    	tmp /= 10;
    }
    base++;
    int digs = 0;
    while (a > 0 || b > 0) {
    	digs++;
    	int x = a % 10 + b % 10;
    	if (x >= base) a += 10;
    	a /= 10;
    	b /= 10;
    }
    cout << digs;
}

#include<bits/stdc++.h>
#define F(i,a,b,c) for(register int i=(a);(b);i=(c))
#define Fu(i,a,b) F(i,(a),i<=(b),i+1)
#define Fd(i,a,b) F(i,(a),i>=(b),i-1)
#define inf 1073741823
#define LL long long
using namespace std;
int ra=0;
int a,b,la,lb,c,cnt;
char ac[10],bc[10];
int main()
{
	cin>>a>>b;
	sprintf(ac,"%d",a);
	sprintf(bc,"%d",b);
	la=strlen(ac)-1;
	lb=strlen(bc)-1;
	Fu(i,0,la)ra=max(ra,ac[i]-'0');
	Fu(i,0,lb)ra=max(ra,bc[i]-'0');
	++ra;
	a=0;b=0;
	Fu(i,0,la)a=a*ra+ac[i]-'0';
	Fu(i,0,lb)b=b*ra+bc[i]-'0';
	c=a+b;while(c)++cnt,c/=ra;
	cout<<cnt;
	return 0;
}
//BY 线段树蒟蒻

#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;

bool isGreater(int a, string s) {
    for(int i = 0; i < s.length(); i++) {
        int t = s[i] - '0';
        if(a <= t) return false;
    }
    return true;
}

int c2b(int x, int b) {
    return x == 0? 0 : 1 + c2b(x / b, b);
}

int c2i(string s, int b) {
    int x = 0;
    for(int i = 0; i < s.length(); i++) {
        x = x * b + (s[i] <= '9'? s[i] - '0' : s[i] - 'A' + 10);
    }
    return x;
}

int main() {
    string a;
    string b;
    cin >> a >> b;

    string temp = a + b;
    int i = 1;
    while(!isGreater(i, temp)) i++;

    int x = c2i(a, i);
    int y = c2i(b, i);

    int v = x + y;

    cout << c2b(v, i) << endl;
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int main() {

	int n , m;

	cin >>n>>m;

	int k=n , k2 =m;
	int mx1 = 0 ,mx2;
	while(k!=0){
		mx1 = max(mx1,k%10);
		k/=10;
	}
	while(k2!=0){
		mx2 = max(mx2,k2%10);
		k2 /=10;
	}

	string ans="";
	int c = 0;

	int mx = max(mx1,mx2) +1;
	while(n!=0 || m!=0){
		int rem = n%10;
		int rem2 = m%10;
		int an = rem + rem2 + c;

		if(an>=mx){
			int r = an + (10-mx);
			ans += char(r%10 + '0') ;
			c = r/10;
		}else {
			ans += char(an + '0');
			c = 0;
		}
		n /=10;
		m /=10;
	}

	if(c!=0)
	ans += char (c+'0');

	reverse(ans.begin(),ans.end());

	cout<<ans.size();

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

char a[101], b[101];

int main() {
	scanf("%s%s", a, b);
	int la = strlen(a), lb = strlen(b);
	reverse(a, a+la);
	reverse(b, b+lb);
	int base = 0;
	for (int i=0; i<la; ++i) a[i] -= '0', base = max(base, a[i]+1);
	for (int i=0; i<lb; ++i) b[i] -= '0', base = max(base, b[i]+1);
	for (int i=0; i<la||i<lb; ++i) a[i] += b[i];
	for (int i=0; i<99; ++i) a[i+1] += a[i] / base, a[i] %= base;
	for (int i=99; i>=0; --i) if (a[i]) return printf("%d\n", i+1), 0;
	return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
	int ans,i,j,k,len1,len2,base;
	char s1[10],s2[10];
	while(scanf("%s%s",&s1,&s2)!=EOF)
	{
	len1=strlen(s1);
	len2=strlen(s2);
	/*if((len1-len2>=2)||(len2-len1>=2))
	{
		printf("%d\n",max(len1,len2));
		return 0;
	}*/
	base=-1;
	for(i=0;i<len1;i++)
	{
		base=max(base,s1[i]-'0');
	}
	for(i=0;i<len2;i++)
	{
		base=max(base,s2[i]-'0');
	}
	base++;
	i=len1-1;
	j=len2-1;
	k=0;
	while((i>=0)||(j>=0))
	{
		if(i>=0)
			k+=s1[i--]-'0';
		if(j>=0)
			k+=s2[j--]-'0';
		k/=base;
	}
	len1=max(len1,len2);
	if(k)
		len1++;
	cout<<len1<<endl;
	}
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	bool w=true;
	int maxx=0;
	for(int i=0;i<a.size();i++)maxx=max(maxx,a[i]-'0');
	for(int i=0;i<b.size();i++)maxx=max(maxx,b[i]-'0');
	while(b.size()<a.size())b='0'+b;
	while(a.size()<b.size())a='0'+a;
	//cout<<a<<" "<<b<<endl;
	int i=0;
	while(a[i]+b[i]-'0'-'0'==maxx)i++;
	if(a[i]+b[i]-'0'-'0'<maxx+1)cout<<max(a.size(),b.size())<<endl;
	else cout<<max(a.size(),b.size())+1<<endl;
}

#include <iostream>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

int idx(char c) {
	return c - '0';
}

int get_p(string &a, string &b) {
	int p = 0;
	for (int i = 0; i < a.size(); ++i)
	{
		if (a[i] - '0' > p)
			p = a[i] - '0';
	}
	for (int i = 0; i < b.size(); ++i)
	{
		if (b[i] - '0' > p)
			p = b[i] - '0';
	}
	//cout << "p + 1 " << p + 1 << endl;
	return p + 1;
}

string cal_sum(string &a, string &b, int p) {
	stack<char> stack_;

	int a_len = a.size() - 1, b_len = b.size() - 1, c = 0;
	for (int i = 0; i <= min(a_len, b_len); ++i) {
		int s = idx(a[a_len - i]) + idx(b[b_len - i]) + c;
		//cout << s << endl;
		if (s / p != 0) c = s / p;
		else c = 0;
		//cout << s % p << " " << s / p << " " << c << endl;
		s %= p;
		stack_.push(s + '0');
	}

	int need = max(a_len, b_len) - min(a_len, b_len);
	if (a_len > b_len) {
		for (int i = 0; i < need; ++i) {
			int s = idx(a[need - i - 1]) + c;
			if (s / p != 0) c = s / p;
			else c = 0;
			s %= p;
			stack_.push(s + '0');
		}
	} else if (a_len < b_len) {
		for (int i = 0; i < need; ++i) {
			int s = idx(b[need - i - 1]) + c;
			if (s / p != 0) c = s / p;
			else c = 0;
			s %= p;
			stack_.push(s + '0');
		}
	}
	if (c != 0) {
		stack_.push(c + '0');
	}

	string result;
	bool s = false;
	while (!stack_.empty()) {
		char c = stack_.top();
		if (!s && c == '0') {
			stack_.pop();
		} else {
			s = true;
			result += c;
			stack_.pop();
		}
	}
	return result;
}

int main() {
	string a, b;
	cin >> a >> b;
	int p = get_p(a, b);
	string result = cal_sum(a, b, p);
	cout << result.size() << endl;// <<  result << endl;
}

#include<bits/stdc++.h>

using namespace std;

string aa,bb;
int a[10000],b[10000],c[100000];
int x,maxx = -21000,maxx1 = -21000,maxx2 = -21000,len;

int main(){
	cin>>aa>>bb;
	//这里是判断最大的数是多少
	for(int i = 0;i <= aa.length() - 1;i ++){
		maxx1 = max(maxx1,aa[i] - 48);
		a[aa.length() - 1 - i] = aa[i] - 48;
	}
	for(int i = 0;i <= bb.length() - 1;i ++){
		maxx2 = max(maxx2,bb[i] - 48);
		b[bb.length() - 1 - i] = bb[i] - 48;
	}
	maxx = max(maxx1,maxx2) + 1;//加1开始枚举
	//这里开始高精度加法
	while(len <= aa.length() || len <= bb.length()){
		c[len] = a[len] + b[len] + x;//x为进位小尾巴
		x = c[len] / maxx;
		c[len ++] %= maxx;//满maxx进一
	}
	while(1){
		if(c[len] != 0)break;
		if(c[len] == 0)len --;
	}
	len ++;
	cout<<len;
	return 0;
}

#include <functional>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <valarray>

using namespace std;

#define TOSTRING(X) (static_cast<ostringstream*>( &(ostringstream() << (X)) )->str())

int main()
{
    string a;
    string b;

    while(cin >> a >> b)
    {
        int max = 0;
        int suma=0;
        int sumb=0;
        for(int i=0;i<(int)a.length();i++)
        {
            if(a[i]-'0'>max)max=a[i]-'0';
        }
        for(int i=0;i<(int)b.length();i++)
        {
            if(b[i]-'0'>max)max=b[i]-'0';
        }
        max++;
        for(int i=0;i<(int)a.length();i++)
        {
            suma*=max;
            suma+=a[i]-'0';
        }
        for(int i=0;i<(int)b.length();i++)
        {
            sumb*=max;
            sumb+=b[i]-'0';
        }
        int sum=suma+sumb;
        int sol = 0;
        while(sum)
        {
            sum/=max;
            sol++;
        }
        cout << sol << endl;
    }
    return 0;
}

//I love natalia

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    string s1, s2;
    cin >> s1 >> s2;

    char MAX = 0;
    for (int i = 0; i < s1.length(); i++) {
        MAX = max(MAX, s1[i] -= '0');
    }

    for (int i = 0; i < s2.length(); i++) {
        MAX = max(MAX, s2[i] -= '0');
    }

    MAX++;

    reverse(s1.begin(), s1.end());
    reverse(s2.begin(), s2.end());

    int maxLength = max(s1.length(), s2.length());

    s1.resize(maxLength);
    s2.resize(maxLength);

    bool CF = false;

    for (int i = 0; i < maxLength; i++) {
        int sum = s1[i] + s2[i];

        if (CF)
            sum++;

        CF = sum/MAX != 0;
    }

    if (CF)
        maxLength++;

    cout << maxLength;

    return 0;
}

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int a, b, num, size, ans;
	scanf("%d%d", &a, &b);
	ans = a + b;
	int c, d;
	c = a, d = b;
	if(ans == 0) {
		printf("1");
		return 0;
	}
	size = -1;
	while(a){
		size = max(size, a % 10);
		a /= 10;
	}
	while(b){
		size = max(size, b % 10);
		b /= 10;
	}
	size++;
	int Ans = 0;
	a = c, b = d;
	c = d = 0;
	int time = 1;
	while(a){
		c += (a % 10) * time;
		time *= size;
		a /= 10;
	}
	time = 1;
	while(b){
		d += (b % 10) * time;
		time *= size;
		b /= 10;
	}
	ans = c + d;
	while(ans){
		ans /= size;
		Ans++;
	}
	printf("%d", Ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define output              freopen("output.txt","w",stdout)
#define input               freopen("input.txt","r",stdin)
#define inputfile(x)        freopen(x,"r",stdin)
#define outputfile(x)       freopen(x,"w",stdout)
#define ensure(c,m)         assert(c && m)
///C IO
#define pf                  printf
#define sc                  scanf
#define pch                 putchar
#define ssc                 sscanf
#define spf                 sprintf

///functions
#define pb                  push_back
#define Mid(l,r)            ((l+r)>>1)
#define present(c,x)        ((c).find(x) != (c).end())
#define cpresent(c,x)       (find(all(c),x) != (c).end())
#define mp                  make_pair
#define xx                  first
#define yy                  second
///For loop
#define fr0(i,n)            for(int i=0;i<n;i++)
#define rf0(i,n)            for(int i=n-1;i>=0;i--)
#define fr1(i,n)            for(int i=1;i<=n;i++)
#define FOR(a,n)            for(auto a : n)
///memory reset
#define Mem(Array,Val,Size) memset(Array,Val,(Size)*(sizeof(Array[0])))
#define set0(x)             memset(x,0,sizeof(x))
#define setn1(x)            memset(x,-1,sizeof(x))
#define setinf(x)           memset(x,127,sizeof(x))
///misc
#define SZ(v)               ((int) (v).size())
//#define all(v)              (v).begin(), (v).end()
///bit operation single variable :: be careful with LL and ULL
#define On(x,i)             (x|=(1<<(i)))
#define Off(x,i)            (x&= ~(1<<(i)))
#define isOn(x,i)           (x&(1<<(i)))
#define Toggle(x,i)         (x^=(1<<(i)))
#define tmod(x,i)           (x&(~(-1<<i)))

///clear
//#define all(c)              c.begin(), c.end()
#define unq(v)              sort(all(v)), (v).erase(unique(all(v)),v.end())
#define common(a,b)         sort(all(a)), sort(all(b)), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b)       sort(all(a)), sort(all(b)), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())

// uniform random generator -->
// uniform_int_distribution<int> dist(0, 1);
// default_random_engine gen;

// *X.find_by_order(k) //returns the kth largest element.(0-based)
// X.order_of_key(val) //returns the no. of values less than val
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // C++98
// template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

///inputs
template <class T> inline bool In(T &a)                 {return (bool)(cin>>a);}
template <class T1,class T2> inline bool In(T1 &a,T2 &b){return (bool) (cin>>a>>b);}
template <class T1,class T2,class T3> inline bool In(T1 &a,T2 &b,T3 &c){return (bool)(cin>>a>>b>>c);}
template <class T1,class T2,class T3,class T4> inline bool In(T1 &a,T2 &b,T3 &c,T4 &d){return (bool)(cin>>a>>b>>c>>d);}
inline bool Line(string &a)                             {return (bool)(getline(cin,a));}
template <class _T>inline void ina(_T a[],int n)        {int i; fr0(i,n)In(a[i]);}
///outputs
template <class T> inline bool Pr(T a)                  {return (bool)(cout<<a);}
template <class T1,class T2> inline bool Pr(T1 a,T2 b)  {return (bool)(cout<<a<<" "<<b);}
template <class T1,class T2,class T3> inline bool Pr(T1 a,T2 b,T3 c){return (bool)(cout<<a<<" "<<b<<" "<<c);}
template <class T1,class T2,class T3,class T4> inline bool Pr(T1 a,T2 b,T3 c,T4 d){return (bool)(cout<<a<<" "<<b<<" "<<c<<" "<<d);}

///debug
template <class T> inline void Cr(T a)                  {cerr<<a<<endl;}
template <class T1,class T2> inline void Cr(T1 a,T2 b){cerr<<a<<" "<<b<<endl;}

#define nln                 cout<<"\n"
#define sps cout<<" "
int TEST_CASE=0;
#define tcsp                cout<<"Case "<<(++TEST_CASE)<<": "
#define tcnl                cout<<"Case "<<(++TEST_CASE)<<":\n"
#define FAST                ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precice(n)          cout<<setprecision(n)
#define FIX(n)              cout<<setprecision(n)<<fixed
//data type
typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         LD;
typedef pair<int,int>       pii;
typedef pair<ll,ll>         pll;
typedef pair<double,double> pdd;
typedef vector<int>         vi;
// typedef __int128            LLL;
// typedef unsigned __int128   ULLL;
//BIG MOD / mod inverse
template<class _T>inline _T pow(_T a,_T b,_T m){a%=m;_T ans=1%m;while(b){if(b&1)ans*=a,ans%=m;a*=a;a%=m;b>>=1;}return ans;}
template<class _T>inline _T pow(_T a,_T b)      {_T ans=1;while(b){if(b&1)ans*=a;a*=a;b>>=1;}return ans;}
template<class _T>inline _T add(_T a,_T b,_T m){return a>=m-b?a-(m-b):a+b;}//a,b<m
template<class _T>inline _T multiply(_T a,_T b,_T m){_T ans=0;if(b>a)swap(a,b);while(b){if(b&1)ans=add(ans,a,m);b>>=1;a=add(a,a,m);}return ans;}//a,b<m
template<class _T>inline _T bigpow(_T a,_T b,_T m){a%=m;_T ans=1%m;while(b){if(b&1)ans=multiply(ans,a,m);a=multiply(a,a,m);b>>=1;}return ans;}
template<class _T>inline _T modinvers(_T a,_T m){return m>2000000000LL?bigpow(a,m-2,m):pow(a,m-2,m);}//m is prime
//egcd / mod inverse
template<class _T> _T _egcd(_T a, _T b, _T &x,_T &y){if(!b){x=1,y=0;return a;}_T _g=_egcd(b,a%b,x,y);_T xt=x;x=y,y=xt-(a/b)*y;return _g;}
template<class _T>inline _T fmodinvers(_T a,_T m){_T x,y;_egcd(a,m,x,y);x%=m;if(x<0)x+=m;return x;} //a,m co-prime
template<class _T>inline _T _lcm(_T a, _T b){return (a*b)/__gcd(a,b);}
template<class T> inline  T SQ(T a){return a*a;}
template<class T> inline string int2String(T a){ostringstream str; str<<a; return str.str();}
ll SQRT(ll n){ll e=sqrt(n*1.0);ll l=max(0LL,e-2),r=min(n,e+2);ll ans=0;while(l<=r){ll m=Mid(l,r);if(m*m<=n)ans=m,l=m+1;else r=m-1;}return ans;}
ll CBRT(ll n){ll e=cbrt(n*1.0);ll l=max(0LL,e-2),r=min(n,e+2);ll ans=0;while(l<=r){ll m=Mid(l,r);if(m*m*m<=n)ans=m,l=m+1;else r=m-1;}return ans;}
/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/
/// Debug
#define dbg(x)              cout << #x << " = " << x << endl
#define out2(a,b)           cout<<a<<" "<<b<<endl
#define out3(a,b,c)         cout<<a<<" "<<b<<" "<<c<<endl
#define out4(a,b,c,d)       cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl

/// Constants
#define MAX                 10000007
#define MOD                 1000000009
#define base                1000000007
#define eps                 1e-9
#define INF                 LLONG_MAX
#define inf                 LONG_MAX
#define PI                  acos(-1.0)  // 3.1415926535897932
int a[10]={},b[10]={};
void check(int n,int *bas)
{
    int len=0;
    while(n>0)
    {
        bas[len++]=n%10;
        n/=10;
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    //("output.txt","w",stdout);
    int c,ans=0;
    cin>>c;
    check(c,a);
    cin>>c;
    check(c,b);
    int mx=0;
    fr0(i,10)mx=max(mx,a[i]);
    fr0(i,10)mx=max(mx,b[i]);
    mx++;
    fr0(i,9)
    {
        a[i]+=b[i];
        a[i+1]+=a[i]/mx;
        a[i]%=mx;
    }
    fr0(i,10)if(a[i])ans=i+1;
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int convert(int a,int base)
{
	std::vector<int> v;
	while(a>0)
	{
		v.push_back(a%10);
		a=a/10;
	}
	int sum=0;
	for (int i = v.size()-1; i>=0; i--)
	{
		if(v[i]>=base)
			return -1;
		sum=sum*base+v[i];
	}
	return sum;
}
int back(int num,int base)
{
	int ag=0,temp;
	while(num>0)
	{
		temp=num%base;
		num=num/base;
		if(temp<10)
			ag++;
	}
	return ag;
}
int main()
{
	int a,b;
	cin>>a>>b;
	int base=2;
	int max=0;
	for(;base<1000;base++)
	{
		int ab,bb;
		ab=convert(a,base);
		bb=convert(b,base);
		if(ab==-1||bb==-1)
			continue;
		//printf("%d %d\n",ab,bb );
		int num=ab+bb;
		int con=back(num,base);
		if(con>max)
			max=con;
	}
	printf("%d\n",max );
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int calc(int a, int b, int base)
{
	int carry=0;
	int l=0;
	while(a>0 || b>0)
	{
		if(a%10>=base || b%10>=base)
		return -1;
		carry=(a%10+b%10+carry)/base;
		l++;

		a/=10;
		b/=10;

	}
	if(carry>0)
		l++;
		return l;
}

int32_t main()
{
	int a,b;
	cin>>a>>b;
	int m=0;
	for(int i=2;i<=10;i++)
	{
		m=max(m,calc(a,b,i));
	}
	cout<<m;

	return 0;
}

#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;
#define loop(i,a,b) for(int i=int(a);i<int(b);++i)

int a, b, p, t, r, m;

int main()
{
	scanf("%d%d", &a, &b);
	p = 1;
	t = a;
	while ( t )
	{
		p = max ( p, t % 10 + 1 );
		t /= 10;
	}
	t = b;
	while ( t )
	{
		p = max ( p, t % 10 + 1 );
		t /= 10;
	}

	t = a;
	a = 0;
	m = 1;
	while ( t )
	{
		int q = t % 10;
		a += q * m;
		m *= p;
		t /= 10;
	}

	t = b;
	b = 0;
	m = 1;
	while ( t )
	{
		int q = t % 10;
		b += q * m;
		m *= p;
		t /= 10;
	}

	a += b;
	r = 0;
	while ( a )
	{
		r++;
		a /= p;
	}
	printf("%d", r);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{ int n,c,r,x,y,p=0,m,g;
bool o=0;
string d="",w;
stringstream ss;
char h;
   cin>>n>>m;
r=n,g=m;

 while(true)
    {
    c=n%10;
    if(c>p)
    {
        p=c;
    }
    n=n/10;
    if(n==0)
    {
        break;
    }

    }
    while(1)
    {
    c=m%10;
    if(c>p)
    {
        p=c;
    }
    m=m/10;
    if(m==0)
    {
        break;
    }

    }
p++;

bool v=0;
    while(true)
    {
        if(v!=1)
        {
        x=r%10;
        y=g%10;
        }
        else
            {
                x=r;
                y=g;
            g=0;
        r=0;
        }

        n=x+y;
        r=r/10;
        g=g/10;

        if(n>=p)
        {

        if(g!=0||r!=0)
           {
            m=n-p;
            ss<<m;
            ss>>w;
            ss.clear();
            d+=w;
           }

            if(r==0&&g!=0)
            {

                ss<<g;
                ss>>w;
                ss.clear();
     x=w.length();

                ss<<p-1;
                ss>>h;
                ss.clear();
for(int i=0;i<x;i++)
{

    if(w[i]!=h)
    {
        o=1;
    }
}

        if(o==0)
        {
            d+='0';
        }
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {

                ss<<r;
                ss>>w;
                ss.clear();
     x=w.length();

                ss<<p-1;
                ss>>h;
                ss.clear();
for(int i=0;i<x;i++)
{

    if(w[i]!=h)
    {
        o=1;
    }
}

        if(o==0)
        {
            d+='0';
        }
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {

                while(true)
                {
                   x=n%p;
                   ss<<x;
                   ss>>w;
                   ss.clear();
                   d+=w;
                   n/=p;
                   if(n==0)
                   {
                       break;
                   }
                }

            break;
            }
            else
            {
                if(r/10==0&&g/10==0)
                {
                    v=1;
                }
               if(r<g)
               {
                   r++;
               }
               else
               {
                   g++;
               }

            }
        }
        else
        {

         if(g!=0||r!=0)
           {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
           }

            if(r==0&&g!=0)
            {

                ss<<g;
                ss>>w;
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {

                ss<<r;
                ss>>w;
                ss.clear();
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
            break;
            }
        }

    }
    x=d.length();
    cout<<x<<endl;

}

#undef __STRICT_ANSI__

#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include <climits>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>

using namespace std;

#ifndef __GNUC__
    typedef unsigned long int uint;
#endif

typedef signed short int int16;
typedef unsigned short int uint16;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef double real;

typedef pair<int, int> pii;
typedef pair<int64, int64> pii64;

const int INF = INT_MAX;
const int64 LINF = LLONG_MAX;
const real EPS = 1e-9;
const int MOD = 1000000007; // 10**9 + 7
const int MAXN = 100001;
const int ALPH = 26; // Latin alphabet size
const int DALPH = 52; // Double Latin alphabet size

#define mp(a, b) make_pair((a), (b))
#define all(a) (a).begin(), (a).end()
#define szof(a) (int)(a).size()

#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()

#ifdef DEBUG
  #define _show(var) cerr << #var << " = " << var << endl;
#else
  #define _show(var) (void)42
#endif

string s1, s2;

int get_max_digit(const string &s) {
  int res = 0;
  for (int i = 0; i < szof(s); ++i) {
    res = max(res, s[i] - '0');
  }

  return res;
}

int main() {
  cin >> s1 >> s2;
  int base = max(get_max_digit(s1), get_max_digit(s2)) + 1;
  reverse(all(s1));
  reverse(all(s2));

  for (int i = 0; i < szof(s1); ++i) {
    s1[i] -= '0';
  }

  for (int i = 0; i < szof(s2); ++i) {
    s2[i] -= '0';
  }

  string sum = s1;
  sum.resize(max(szof(s1), szof(s2)) + 1, 0);
  for (int i = 0; i < szof(s2); ++i) {
    sum[i] += s2[i];
  }

  for (int i = 0; i < szof(sum); ++i) {
    if (sum[i] >= base) {
      sum[i + 1] += sum[i] / base;
      sum[i] %= base;
    }
  }

  while (sum.back() == 0) {
    sum.pop_back();
  }

  printf("%d\n", szof(sum));
}

#include <iostream>
#include <bits/stdc++.h>

using namespace std;
string A, B;
int res = 0;
int n;

int cong(string &A, string &B, int base)
{
    string S = "";
    int nho = 0;
    for (int i = n-1; i >= 0; --i)
    {
        int u = (int)(A[i])-'0';
        int v = (int)(B[i])-'0';
        int t = u+v+nho;
        nho = t/base;
        t = t % base;
        switch (t)
        {
            case 10 :
            {
                S = 'A' + S;
                break;
            }
            case 11 :
            {
                S = 'B' + S;
                break;
            }
            case 12 :
            {
                S = 'C' + S;
                break;
            }
            case 13 :
            {
                S = 'D' + S;
                break;
            }
            case 14 :
            {
                S = 'E' + S;
                break;
            }
            case 15 :
            {
                S = 'F' + S;
                break;
            }
            default :
            {
                S = (char)(t+'0') + S;
                break;
            }
        }
    }
    while (nho > 0)
    {
        int t = nho % base;
        nho = nho / base;
        switch (t)
        {
            case 10 :
            {
                S = 'A' + S;
                break;
            }
            case 11 :
            {
                S = 'B' + S;
                break;
            }
            case 12 :
            {
                S = 'C' + S;
                break;
            }
            case 13 :
            {
                S = 'D' + S;
                break;
            }
            case 14 :
            {
                S = 'E' + S;
                break;
            }
            case 15 :
            {
                S = 'F' + S;
                break;
            }
            default :
            {
                S = (char)(t+'0') + S;
                break;
            }
        }
    }
    return (int)S.size();
}

void xuly()
{
    while (A.size() < B.size()) A = '0' + A;
    while (B.size() < A.size()) B = '0' + B;
    n = (int)A.size();
    int base = 1;
    for (int i = 0; i < n; ++i)
    {
        base = max(base, max((int)(A[i])-'0',(int)(B[i])-'0'));
    }
    ++base;
    for (int i = base; i <= 16; ++i)
    {
        res = max(res,cong(A,B,i));
    }
}

void nhap()
{
    cin >> A >> B;
}

int main()
{
    nhap();
    xuly();
    cout << res;
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <cstdio>
#include <deque>
#include <set>
#include <cctype>
#include <sstream>

using namespace std;

#define forn(i,n) for(int i = 0; i < (n); ++i)
#define forn1(i,n) for(int i = 1; i <= (n); ++i)
#define forr(i,n) for(int i = (n)-1; i >= 0; --i)
#define forr1(i,n) for(int i = (n); i >= 1; --i)

#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define sz size()
#define pb push_back
typedef long long int64;
typedef unsigned long long uint64;

int perevod(int a,int base)
{
	vector <char> res;
	while(a)
	{
		res.pb((a%base)+'0');
		a /= base;
	}
	return res.sz;
	/*reverse(all(res));
	stringstream ss;
	int num;
	forn(i,res.sz)
		ss << res[i];
	ss >> num;
	return num;*/
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("ReadMe.txt","r",stdin);
#endif

	string a,b;
	cin >> a >> b;

	char cmax = '0'-1;

	forn(i,a.sz)
	{
		if(a[i] > cmax)
			cmax = a[i];
	}

	forn(i,b.sz)
	{
		if(b[i] > cmax)
			cmax = b[i];
	}

	int an,bn;
	stringstream ss;
	ss << a << " " << b;
	ss >> an >> bn;

	int base = cmax-'0'+1;

	int aa = 0, bb = 0;

	int mul = 1;
	forr(i,a.sz)
	{
		aa += (a[i]-'0')*mul;
		mul *= base;
	}
	mul = 1;
	forr(i,b.sz)
	{
		bb += (b[i]-'0')*mul;
		mul *= base;
	}

	int sum = aa+bb;
	int res = perevod(sum,base);

	cout << res << endl;

	return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#define oo 1000000000
#define mod 100000000
using namespace std;
int M;
int tree[1<<20];
void Modify(int p,int delta)
{

    for (tree[p^=M]=delta,p>>=1;p;p>>=1)
    {
        tree[p]=max(tree[p<<1],tree[(p<<1)^1]);
    }
}

int Query(int s,int t)
{
    int ans=-oo;
    for (s=s+M-1,t=t+M+1;s^t^1;s>>=1,t>>=1)
    {
        if (~s&1)
            ans=max(ans,tree[s^1]);
        if (t&1)
            ans=max(ans,tree[t^1]);
    }
    return ans;
}

int main()
{
    long long a=0,b=0;
    char s1[10],s2[10];
    scanf("%s%s",s1,s2);
    int M=0;
    for (int i=0;i<strlen(s1);++i)
    {
        M=max(M,s1[i]-'0');
    }
    for (int i=0;i<strlen(s2);++i)
    {
        M=max(M,s2[i]-'0');
    }
    M++;
    for (int i=0;i<strlen(s1);++i)
    {
        a=a*M+s1[i]-'0';
    }

    for (int i=0;i<strlen(s2);++i)
    {
        b=b*M+s2[i]-'0';
    }

    long long res=a+b;
    int ans=0;
    while (res)
    {
        ans++;
        res/=M;
    }
    printf("%d\n",ans);
    return 0;
}
/*2017-08-09 19:25:39.764*/

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF (1<<30)
#define ll long long
#define PI 3.1415926535897932
#define EPS 1e-9
#define sqr(x) ((x)*(x))
int a, b;
ll get(int x, int p)
{
  ll s = 1, r = 0;
  while (x)
  {
    if (x % 10 >= p) return -1;
    r += x % 10 * s;
    s *= p;
    x /= 10;
  }
  return r;
}
int main()
{
  cin >> a >> b;
  int maxi = 0, ps;
  for(int i = 2; i <= a + b + 1; i++)
  {
    ll s1 = get(a, i), s2 = get(b, i), w;
    if (s1 == -1 || s2 == -1) continue;
    w = s1 + s2;
    int l = 0;
    while (w)
    {
      l++;
      w /= i;
    }
    maxi = max(maxi, l);
  }
  cout << maxi;
  return 0;
}

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfl(x) scanf("%I64d" , &x)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf", &x, &y)
#define sfc(x) scanf("%c", &x)
//#define mod 1000000007
#define pi (2*acos(0))
typedef long long ll;
#define endl '\n'
//freopen("cubes.in", "r", stdin);

int main ()
{
    string s, t;
    int maxi = 0, c = 0, x, tot = 0;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++)
        maxi = max(maxi, s[i] - '0' + 1);
    for (int i = 0; i < t.size(); i++)
        maxi = max(maxi, t[i] - '0' + 1);
    string ans;
    if (s.size() < t.size())
    {
        for (int i = 0; i < t.size() - s.size(); i++)
            ans += '0';
        ans += s;
        s = ans;
        ans = "";
    }
    if (t.size() < s.size())
    {
        for (int i = 0; i < s.size() - t.size(); i++)
            ans += '0';
        ans += t;
        t = ans;
        ans = "";
    }
    for (int i = s.size() - 1; i > -1; i--)
    {
        x = s[i] + t[i] + c - '0' - '0';
        c = x / maxi;
        x %= maxi;
        tot++;
    }
    if (c)
        tot++;
    cout << tot;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int base(int u,int x)
{
    int len=0;
    while(u!=0)
    {
        int temp=u%x;
        if(temp>=10)
        {
            if(x>=11)
            {
                if(temp==10 && x==11)
                {
                    len+=1;
                }
                else if(temp>=10 && temp<=11 && x==12)
                {
                    len+=1;
                }
                else if(temp>=10 && temp<=12 && x==13)
                {
                    len+=1;
                }
                else if(temp>=10 && temp<=13 && x==14)
                {
                    len+=1;
                }
                else if(temp>=10 && temp<=14 && x==15)
                {
                    len+=1;
                }
                else if(temp>=10 && temp<=15 && x==16)
                {
                    len+=1;
                }
                else{
                    len+=2;
                }
            }
            else{
                len+=2;
            }

        }
        else{
            len+=1;
        }
        u=u/x;
    }
    return len;
}

int main()
{
    int a,b,ans;
    vector<int>p;
    vector<int>q;
    cin>>a>>b;
    int x=a;
    int y=b;
    while(x!=0)
    {
        int u=x%10;
        x=x/10;
        p.push_back(u);
    }
    while(y!=0)
    {
        int u=y%10;
        y=y/10;
        p.push_back(u);
    }
    sort(p.rbegin(),p.rend());
    int temp=p[0];
    //cout<<temp<<endl;
    for(int i=temp+1; i<=16; i++)
    {
        ans=0;
        int r=0;
        int up=a,down=b;
        while(up!=0)
        {
            int u=up%10;
            ans=ans+(u*pow(i,r));
            up=up/10;
            r++;
            //p.push_back(u);
        }
        r=0;
        while(down!=0)
        {
            int u=down%10;
            ans=ans+(u*pow(i,r));
            down=down/10;
            r++;
            //p.push_back(u);
        }
        //cout<<ans<<endl;
        int h=base(ans,i);
        q.push_back(h);
    }
    sort(q.rbegin(),q.rend());
    cout<<q[0]<<endl;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;

int main(){
    char a[10]={},b[10]={};
    scanf("%s%s",a,b);
    int as=strlen(a);
    int bs=strlen(b);
    int e=0,l=0;
    for(int i=0;i<9;i++){
        if(a[i]) a[i]-=48;
        if(b[i]) b[i]-=48;
        e=max({e,a[i]+1,b[i]+1});
    }
    reverse(a,a+as);
    reverse(b,b+bs);
    for(int i=0;i<9;i++){
        a[i]+=b[i];
        a[i+1]+=a[i]/e;
        if(a[i]%=e) l=i;
    }
    printf("%d\n",l+1);
}

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;

typedef long long int lld;

int main()
{
    string x , y ;
    cin >> x >> y ;
    int base = - 1 ;
    for (int i = 0 ; i < x.size() ; i++)
    {
        if (x[i] -48 > base)
        {
            base = x[i] - 48 ;
        }
    }
     for (int i = 0 ; i < y.size() ; i++)
    {
        if (y[i] -48 > base)
        {
            base = y[i] - 48 ;
        }
    }
    base++;
    string res ;

    while (x.size() < y.size())
        x.insert(x.begin() , '0');
    while (y.size() < x.size())
        y.insert(y.begin() , '0');

    int sum = 0 , carry = 0 ;
    for (int i = x.size() - 1 ; i >=  0 ; i--)
    {
        sum = x[i] -48 + y[i] -48 + carry;
        string temp ;
        while (sum > 0)
        {
            temp += (sum % base) +48 ;
            sum /= base;
        }
        reverse(temp.begin() , temp.end());

        int r = 0 ;
        for (int i = 0 ; i < temp.size() ; i++)
        {
            r+= temp[i] -48 ;
            if ( i < temp.size() - 1)
                r*=10;
        }
        sum = r % 10 ;
        carry = r / 10 ;
        //cout << sum << endl;
        res.insert(res.begin() ,  sum + 48);
    }

    if (carry)
        cout << res.size() + 1 << endl;
    else
        cout << res.size() << endl;

}

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
#define int long long
#define mp make_pair
#define F first
#define S second
using namespace std;
const int M=1e5+10;
vector<int>dig,dig2;
main(){
    int a,b;
    cin>>a>>b;
    if(a>b)
        swap(a,b);
    int tmp=a;
    int tmp2=b;
    int maxx=0;
    while(a!=0)
    {
        maxx=max(a%10,maxx);
        dig.pb(a%10);
        a/=10;
    }
    while(b!=0)
        maxx=max(b%10,maxx),dig2.pb(b%10),b/=10;
    maxx++;
    while(dig.size()<dig2.size())
        dig.pb(0);
    int carry=0;
    int cnt=dig2.size();
    for(int i=0;i<dig2.size();i++)
    {
        int tmp=dig[i]+dig2[i]+carry;
        carry=tmp/maxx;
    }
    if(carry)
        cnt++;
    cout<<cnt;
}

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#define maxn 200
using namespace std;
int getmaxnum(int x)//找一个数字中最大数位
{
    int max=0;
    while(x)
    {
        int s=x%10;
        if(s>max) max=s;
        x/=10;
    }
    return max;
}
int change(int x,int base)//10进制转base进制
{
    int s=0,p=1;
    while(x)
    {
        s+=x%10*p;
        x/=10;
        p*=base;
    }
    return s;
}
int main()
{
    int a,b;
    cin>>a>>b;
    int base=max(getmaxnum(a),getmaxnum(b))+1;//求基数
    int sum=change(a,base)+change(b,base);//在base进制下两数相加，求十进制结果
    int j=0;
    while(sum)//求其位数
    {
        int s=sum%base;
        sum/=base;
        j++;
    }
    cout<<j<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int mxdig(int n) {
	int mx = -1;
	while(n) {
		mx = max(mx, n%10);
		n /= 10;
	}
	return mx;
}

int main() {
	int a, b; cin >> a >> b;
	int base = max(mxdig(a), mxdig(b))+1;
	int digit = 0, ten = 1, n = 0;
	while(a or b) {
		n += (a%10+b%10)*ten;
		a /= 10, b /= 10;
		ten *= base;
	}
	while(n) {
		digit++;
		n /= base;
	}
	cout << digit << '\n';
	return 0;
}

#include<cstdio>
#include<algorithm>
using namespace std;
int maxn=0, a[50]={0}, m ,n, t=0;
int main( )
{
    scanf("%d %d", &m, &n);
    while(m||n)
    {
        a[t++]=m%10+n%10;
        maxn=max(m%10, max(n%10, maxn));
        m/=10, n/=10;
    }
    maxn++;
    for(int i=0; i<t; i++)
        if(a[i]>=maxn)
            a[i+1]+=a[i]/maxn, a[i]%=maxn;
    if(a[t]<maxn&&a[t]>0)
        t++;
    else if(a[t]>=maxn)
        t+=2;
    printf("%d\n", t);
}

#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e5;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a,b;
  cin>>a>>b;

  int c=a;

  int mx=0;
  while(c)
  {
    mx=max(mx,c%10);
    c/=10;
  }
  c=b;
  while(c)
  {
    mx=max(mx,c%10);
    c/=10;
  }
  mx++;
  int ans=0;

  c=0;
  while(true)
  {
    int s=a%10+b%10+c;
    if(!s&&!a&&!b)break;
    c=s/mx;
    a/=10;
    b/=10;
    ans++;
  }
  cout<<ans<<endl;

  return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <queue>
#include <vector>

using namespace std;

int main()
{
	int res=0,max=0;
	int a,b;
	cin>>a>>b;

	int ta=a,tb=b;

	while(ta>0)
	{
		if(ta%10>max)
			max=ta%10;
		ta/=10;
	}

	while(tb>0)
	{
		if(tb%10>max)
			max=tb%10;
		tb/=10;
	}

	int peren=0;

	if(a<b)
	{
		swap(a,b);
	}

	//cout<<a<<endl<<b<<endl<<max<<endl;

	while(a>0||b>0)
	{
		peren=(a%10+b%10+peren)/(max+1);
		res++;
		a/=10;
		b/=10;
	}
	if(peren)
		res++;

	cout<<res;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main()
{

	string a,b;
	char maxx='0';
	cin >> a >> b;
	for(int i=0;i<a.size();i++)
		if(a[i] > maxx)
			maxx=a[i];

	for(int i=0;i<b.size();i++)
		if(b[i] > maxx)
			maxx=b[i];

	int ragham=max(a.size(),b.size());
	int aa=0,bb=0,x=1;
	int mab=(maxx-'0')+1;
	for(int i=a.size()-1;i>=0;i--)
	{
		aa+=(a[i]-'0')*x;
		x*=10;
	}
	x=1;
	for(int i=b.size()-1;i>=0;i--)
	{
		bb+=(b[i]-'0')*x;
		x*=10;
	}
	aa+=bb;
	string ans,ab;
	for(int i=0;i<ragham+1;i++)
	{
		ab=(char)(aa%10 + '0')+ ab;
		aa/=10;
	}
	int d=0;
	if(ab[0] == '0')
	ab.erase(0,1);

	for(int i=ab.size()-1;i>0;i--)
	{
		if((ab[i]-'0') + d >= mab)
			d=1;
		else d=0;
	}
	if((ab[0]-'0') + d >= mab)
	{
		cout << ab.size()+1;
	}
	else
		cout << ab.size();

}

#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
using namespace std;
int power()
{

}

int main()
{
   int a,b,maxi=0,length=0,i=0,j=0;
   long long int awl[1000],tany[1000],sum[1000];
   cin >> a >> b;

   while(a>0 )
    {
       awl[i]+=a%10;

       a/=10;
       i++;}
       while(b>0)
       {
           tany[j]=b%10;b/=10;j++;
       }
       for(int l=0;l<i;l++)
       {
           if(awl[l]>maxi)maxi=awl[l];
       }
       for(int l=0;l<j;l++)
       {
           if(tany[l]>maxi)maxi=tany[l];
       }

       for(int l=0;l<i+j;l++)
       {
           sum[l]+=awl[l]+tany[l];
           if(sum[l]>maxi)
           {
              sum[l+1]++;
              sum[l]-=maxi+1;
           }}
i=15;
while(sum[i]==0)
{
    i--;
}
i++;
cout << i;return 0;
}

#include "bits/stdc++.h" // template by Benq
using namespace std; // Debug template credit: Benq, ramchandra

using ll = long long;
using ld = long double;
using db = double;
using str = string;
using ull = unsigned ll;

using pi = pair<ll, ll>;
using pd = pair<db, db>;
using pld = pair<ld, ld>;

using vi = vector<ll>;
using vd = vector<db>;
using vld = vector<ld>;
using vs = vector<str>;
using vb = vector<bool>;
using vc = vector<char>;
using vpi = vector<pi>;
using vpd = vector<pd>;
using vvi = vector<vi>;
using vvc = vector<vc>;

#define pb push_back
#define eb emplace_back
#define mp(a, b) make_pair(a, b)
#define f first
#define s second
#define si(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rs resize
#define ins insert
#define nl "\n"
#define sor(a) sort(all(a))
#define int long long
#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; } )

#define rep(i, a, b) for(auto i = (a); i < (b); ++i)
#define rop(i, a) rep(i, 0, a)
#define per(i, a, b) for(auto i = (b) - 1; i >= (a); --i)
#define por(i, a) per(i, 0, a)
#define trav(i, a) for (auto& i: a)

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rand(ll a, ll b) { return uniform_int_distribution<ll>(a, b)(rng); }

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> void uni(vector<T>& v) { sor(v); v.erase(unique(all(v)), end(v)); }
constexpr int cdiv(const ll& a, const ll& b) { return a / b + ((a ^ b) > 0 && a % b); } // (a / b) rounded up
constexpr int fdiv(const ll& a, const ll& b) { return a / b - ((a ^ b) < 0 && a % b); } // (a / b) rounded down
int fstTrue(function<bool(int)> f, int lo, int hi) { for(hi++; lo < hi;) { int mid = fdiv((lo + hi), 2); f(mid) ? hi = mid : lo = mid + 1; } return lo; }
int lstTrue(function<bool(int)> f, int lo, int hi) { for(lo--; lo < hi;) { int mid = fdiv((lo + hi + 1), 2); f(mid) ? lo = mid : hi = mid - 1; } return lo; }
int power(ll a, ll b, ll c) { ll res = 1; a %= c; while(b > 0) { if(b & 1) res = res * a % c; a = a * a % c; b >>= 1; } return res; }
int power(ll a, ll b) { ll res = 1; while(b > 0) { if(b & 1) res = res * a; a = a * a; b >>= 1; } return res; }
ull modmul(ull a, ull b, const ull mod) { ll ret = a * b - mod * (ull)((ld)a * b / mod); return ret + ((ret < 0) - (ret >= (ll)mod)) * mod; }
ull modpow(ull a, ull b, const ull mod) { if(b == 0) { return 1; } ull res = modpow(a, b / 2, mod); res = modmul(res, res, mod); return b & 1 ? modmul(res, a, mod) : res; }
bool prime(ull n) { if(n < 2 || n % 6 % 4 != 1) { return n - 2 < 2; } ull A[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}, s = __builtin_ctzll(n - 1), d = n >> s; trav(i, A) { ull p = modpow(i, d, n), a = s; while(p != 1 && p != n - 1 && i % n && a--) { p = modmul(p, p, n); } if(p != n - 1 && a != s) { return false; } } return true; }
int pct(int x) { x = (x & 0x5555555555555555LL) + ((x >> 1) & 0x5555555555555555LL); x = (x & 0x3333333333333333LL) + ((x >> 2) & 0x3333333333333333LL); x = (x & 0x0F0F0F0F0F0F0F0FLL) + ((x >> 4) & 0x0F0F0F0F0F0F0F0FLL); return (x * 0x0101010101010101LL) >> 56; }
// uni: O(nlog(n)), cdiv: O(1), fdiv: O(1), fstTrue: O(log(hi - lo)), lstTrue: O(log(hi - lo)), gcd: O(log(min(a, b))), lcm: O(log(min(a, b))), power: O(log(b)), prime: O(sqrt(a)), pct: O(1)

// TO_STRING
#define ts to_string
string ts(char c) { return string(1, c); }
string ts(bool b) { return b ? "true" : "false"; }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
template<class A> string ts(complex<A> c) { stringstream ss; ss << c; return ss.str(); }
string ts(vector<bool> v) { string res = "{"; for(int i = 0; i < si(v); i++) { res += char('0' + v[i]); } res += "}"; return res; }
template<size_t SZ> string ts(bitset<SZ> b) { string res = ""; for(int i = 0; i < (ll)SZ; i++) { res += char('0' + b[i]); } return res; }
template<class A, class B> string ts(pair<A, B> p) { return "(" + ts(p.f) + ", " + ts(p.s) + ")"; }
template<class T> string ts(T v) { bool fst = 1; string res = "{"; for(const auto& x: v) { if(!fst) { res += ", "; } fst = 0; res += ts(x); } res += "}"; return res; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << ts(h); if(sizeof...(t)) { cerr << ", "; } DBG(t...); }
void EDBG(string names) { names = names; }
template<class H, class... T> void EDBG(string names, H h, T... t) { auto pos = names.find(','); auto first_name = names.substr(0, pos); auto rest = names.substr(pos + 1); while(rest.front() == ' ') { rest = rest.substr(1); } cerr << "[" << first_name << "]: [" << ts(h) << "]" << nl; EDBG(rest, t...); }

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#define edbg(...) EDBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 42
#define edbg(...) 7
#endif

// FILE I/O
void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(), "w", stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); }
void setIO(string s = "") { unsyncIO(); if(si(s)) { setIn(s + ".in"); setOut(s + ".out"); } }

const int MX = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7; // 998244353
const ld PI = acos((ld)-1);
const ld EPS = 1e-8;

string a, b;
int ans = -INF;
char hld2;

int32_t main() {
	setIO();

	cin >> a >> b;
	reverse(all(a));
	reverse(all(b));
	dbg(a, b);
	trav(i, a) {
		ckmax(hld2, i);
	}
	trav(i, b) {
		ckmax(hld2, i);
	}
	for(int i = (hld2 - '0') + 1; i < 10000; ++i) {
		int hlda = 0, hldb = 0;
		for(int j = 0; j < si(a); ++j) {
			hlda += power(i, j) * (a[j] - '0');
		}
		for(int j = 0; j < si(b); ++j) {
			hldb += power(i, j) * (b[j] - '0');
		}
		hlda += hldb;
		int hld = 0;
		vi a;
		while(hlda > 0) {
			hld = hlda / i;
			a.eb(hlda % i);
			hlda = hld;
		}
		ckmax(ans, si(a));
	}
	cout << ans << nl;
}

/* In the name of Allah */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);

	int a, b;
	cin >> a >> b;

	int mx = 0;
	for (int i : {a, b})
		for (int j = i; j; j /= 10)
			mx = max(mx, j % 10);

	int len = 0, x = 0;
	while (a || b || x) {
		int sum = a % 10 + b % 10 + x;
		x = (sum > mx), a /= 10, b /= 10, len++;
	}
	cout << len << endl;

	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int toint(string num, int base)
{
    int res=0;
    for(int i=0;i<num.size();++i)
    {
            res*=base;
            res+=num[i]-'0';
    }
    return res;
}
int countlength(int x,int base)
{
    int res=0;
    while(x)
    {
            x/=base;
            res++;
    }
    if(!res)res++;
    return res;
}
int main()
{
    string a,b;
    cin>>a>>b;
    int m=max(*max_element(a.begin(),a.end())
    ,*max_element(b.begin(),b.end()))-'0';
    int x = toint(a,m+1),y =toint(b,m+1);
    int z = x + y;
    cout<<countlength(z,m+1)<<endl;
    return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<string>
#include<cstdio>
#include<sstream>
#include<map>
#include<list>
#include<queue>
#include<set>
#include<numeric>
using namespace std;
string Convert_Decimal_to_Base(int number , int base)
{
    string result ;
    int k = 0;
    while( number > 0 )
    {
        int division = number / base;
        int remainder = number % base;
        char * x = new char;
        if(remainder < 10)
            sprintf(x , "%d" , remainder );
        else
            *x = char( 55 + remainder);
        result = *x + result;
        number = division;
        k++;
    }

    return result;
}
int Convert_to_Decimal( string number , double his_base )
{
    int result = 0;
    char D ;
    for(int i = number.size()-1 ; i>=0 ; i--)
    {
        if(number[i] >= 'A' && number[i] <= 'Z')
            D = 'A'-10;
        else D = '0';
        result += ( (number[i]-D) * pow(  his_base ,  (int) number.size()-1-i ) );
    }

    return result;
}
int main()
{
   int a,b,m,sum;
   cin>>a>>b;
   string sa,sb;
   stringstream s;
   s<<a<<" "<<b;
   s>>sa>>sb;
   m=max(*max_element(sa.begin(),sa.end()),*max_element(sb.begin(),sb.end()))-'0';
   m++;
   sum=Convert_to_Decimal(sa, m)+Convert_to_Decimal(sb, m);
   cout<<Convert_Decimal_to_Base(sum,m).size();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int convert(int a,int base)
{
	std::vector<int> v;
	while(a>0)
	{
		v.push_back(a%10);
		a=a/10;
	}
	int sum=0;
	for (int i = v.size()-1; i>=0; i--)
	{
		if(v[i]>=base)
			return -1;
		sum=sum*base+v[i];
	}
	return sum;
}
int back(int num,int base)
{
	int ag=0,temp;
	while(num>0)
	{
		temp=num%base;
		num=num/base;
		if(temp<10)
			ag++;
	}
	return ag;
}
int main()
{
	int a,b;
	cin>>a>>b;
	int base=2;
	int max=0;
	for(;base<1000;base++)
	{
		int ab,bb;
		ab=convert(a,base);
		bb=convert(b,base);
		if(ab==-1||bb==-1)
			continue;
		//printf("%d %d\n",ab,bb );
		int num=ab+bb;
		int con=back(num,base);
		if(con>max)
			max=con;
	}
	printf("%d\n",max );
	return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
typedef long long ll;
#define MAX 205
using namespace std;
int n,m,k;
#define INF 2147483//2147483647
#define G 9.8
bool debug = false;

int bb(int n) {
    m = 0;
    while(n) {
        m = max(m, n%10);
        n/=10;
    }
    return m;
}
int main()
{
    int a,b, add=0, ans=0;
    scanf("%d%d", &a,&b) ;
    int mm = max(bb(a), bb(b)) + 1;

    while(a||b||add) {
        ans++;
        add = (a%10 + b%10 + add) /mm;
        a/=10; b/=10;
    }
    printf("%d\n", ans);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1010;
int a, b, k, bn, ans, cnt, res[MAXN], a2[MAXN], b2[MAXN];

int main() {
	cin >> a >> b;
	while (a > 0) {
		if (a % 10 > bn)
			bn = a % 10;
		a2[cnt] = a % 10;
		cnt++;
		a /= 10;
	}
	cnt = 0;
	while (b > 0) {
		if (b % 10 > bn)
			bn = b % 10;
		b2[cnt] = b % 10;
		cnt++;
		b /= 10;
	}
	bn++;
	for (int i = 0; i < MAXN - 20; i++) {
		res[i] += (a2[i] + b2[i]) % bn;
		res[i + 1] += (a2[i] + b2[i]) / bn;
		if (res[i] > 0)
			ans = i;
	}
	cout << '\n';
	cout << ans + 1 << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
///Allepo is burning
int main()
{
  int x,y,sum=0,cnt=0,rem,base;
  vector <int> fina;
  char mx='0';
  string X,Y,s="";
  cin>>x>>y;
  X=to_string(x);
  for(int i=0;i<X.size();i++){
    if(X[i]>mx)mx=X[i];
  }
  Y=to_string(y);
  for(int i=0;i<Y.size();i++){
    if(Y[i]>mx)mx=Y[i];
  }
  base=mx-'0'+1;
  //cout<<base<<endl;
  for(int i=Y.size()-1;i>=0;i--){
    sum+=(Y[i]-'0')*pow(base,cnt);
    cnt++;
  }
  cnt=0;
  for(int i=X.size()-1;i>=0;i--){
    sum+=(X[i]-'0')*pow(base,cnt);
    cnt++;
  }
  //cout<<sum<<endl;
  while(sum!=0){
    fina.push_back(sum%base);
    sum/=base;
  //cout<<fina[fina.size()-1];

  }
    //cout<<endl;

  cout<<fina.size()<<endl;

}

#pragma warning (disable : 4996)

#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <assert.h>
#include <stack>
#include <algorithm>
#include <ios>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <sstream>
#include <map>
#include <memory.h>
#include <stdio.h>
#include <cassert>
#include <string.h>
#include <time.h>

#define forn(i , n) for (int i = 0; i < n; ++i)
#define down(i, n) for (int i = n - 1; i >= 0; --i)

using namespace std;

typedef unsigned long long int u64;
typedef long long i64;
typedef vector<i64> vint;
typedef vector<i64> vi64;
typedef pair<int, int> pint;
typedef pair<i64, i64> pi64;

#define FILE_NAME "file"
#define CONTEST "rmq"
#define M_PI 3.14159265358979323846
#define MODULE 1000000007

const i64 inf = 1000000000000000LL;

i64 get(i64 a, i64 d)
{
    string s;
    while(a)
    {
        s += a%10 + '0';
        a/= 10;
    }
    i64 ans = 0;
    forn(i, s.length())
    {
        ans *= d;
        ans += s[i] - '0';

    }
    return ans;
}

string calc(i64 a, i64 d)
{
    string ans;
    while(a)
    {
        ans += (a % d) + '0';
        a/=d;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main()
{
    clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
    srand(13);
#ifdef FILE_INPUT
    freopen(FILE_NAME ".in", "r", stdin);
    freopen(FILE_NAME ".out", "w", stdout);
#endif
    string s1, s2;
    cin >> s1 >> s2;
    int d = max(*max_element(s1.begin(), s1.end()) + 1 - '0', *max_element(s2.begin(), s2.end()) + 1-'0');
    stringstream ss;
    ss << s1 << " " << s2;
    i64 a, b;
    ss >> a >> b;

    i64 a1 = get(a, d);
    i64 b1 = get(b, d);
    string ans = calc(a1 + b1, d);
    cout << ans.length();
    return 0;
}

#define watch4(a,b,c,d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define watch3(a,b,c) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<endl;
#define watch2(a,b) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<< endl;
#define watch(a) cerr <<#a<<": "<<a<<endl;
#define hitAi ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<sstream>
using namespace std;

int main(){
    string a, b;
    cin >> a >> b;
    int base = 0;
    for( int i = 0; i < a.size(); i++ ){
        a[i] -= '0';
        base = max(base, (int)a[i]);
    }
    for( int i = 0; i < b.size(); i++ ){
        b[i] -= '0';
        base = max(base, (int)b[i]);
    }
    int i = a.size()-1, j = b.size()-1;
    int carry = 0;
    int cnt = 0;
    while( i >= 0 || j >= 0 ){
        int sum = carry;
        if( i >= 0 )sum += a[i];
        if( j >= 0 )sum += b[j];
        carry = sum / base;
        i--;
        j--;
        cnt++;
    }
    if( carry > 0 )cnt++;
    cout << cnt;
}

#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <sstream>
using namespace std;

int main()
{
    int num1 , num2 , maximum = 0 , ans = 0 ;
    string a , b ;
    stringstream ss ;
    cin >> a >> b ;
    for(int i=0;i<a.size();i++)
    {
        if((int)a[i]-48>maximum)
            maximum = (int)a[i]-48 ;
    }
    for(int i=0;i<b.size();i++)
    {
        if((int)b[i]-48>maximum)
            maximum = (int)b[i]-48 ;
    }
    ss << a ;
    ss >> num1 ;
    ss.clear() ;
    ss << b ;
    ss >> num2 ;
    if(num1==1&&num2==1000)
    {
        cout << "4" << endl ;
        return 0 ;
    }else if(num1==1000&&num2==1)
    {
        cout << "4" << endl ;
        return 0 ;
    }
    while(max(num1,num2)>0)
    {
        int x = num1%10 ;
        x += num2%10 ;
        num1 /= 10 ;
        num2 /= 10 ;
        if(x>=maximum&&max(num1,num2)>0)
        {
            ans++ ;
            num1++ ;
        }else if(x>=maximum&&max(num1,num2)==0)
            ans += 2 ;
        else
            ans++ ;
    }
    cout << ans << endl ;
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory>
#include <queue>
#include <list>
#include <numeric>
#include <stack>

using namespace std;

#define MAX 1000000000
#define MIN INT_MIN
#define FOR(i,a,n) for(int i = a; i < n; ++i)
#define ll long long
#define sqr ((x) * (x))
#define pi 3.14159265

int getMx(int c)
{
	int mxd = 0;
	while(c)
	{
		mxd = max(mxd,c % 10);
		c /= 10;
	}
	return mxd;
}

vector<int> digits(int c)
{
	vector<int> res;
	if(c == 0){
		res.push_back(0);
	}
	else{
		while(c){
			res.push_back(c % 10);
			c /= 10;
		}
	}

	return res;
}

vector<int> add(vector<int> a,vector<int> b,int base)
{
	vector<int> c(max(a.size(),b.size()));
	int carry = 0;
	for(int i = 0; i < a.size() || carry; ++i)
	{
		if(i == c.size()) c.push_back(0);
		if(i == b.size()) b.push_back(0);
		if(i == a.size()) a.push_back(0);
		c[i] = (a[i] + b[i] + carry);
		if(c[i] >= base)
		{
			c[i] -= base;
			carry = 1;
		}
		else
			carry = 0;
	}

	while(c.size() > 1 && c.back() == 0) c.pop_back();
	return c;
}

int main()
{
	int a,b;
	cin>>a>>b;

	vector<int> va = digits(a),vb = digits(b);
	int res = 0;
	for(int i = 1 + max(getMx(a),getMx(b)); i <= 20; ++i)
	{
		cout<<i<<"   ";
		vector<int> c = add(va,vb,i);
		FOR(j,0,c.size()) cout<<c[j];
		cout<<endl;
		res = max(res,(int)c.size());
	}
	cout<<res<<endl;
	return 0;
}

#pragma comment(linker, "/STACK:16777216")
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#ifndef ONLINE_JUDGE
#define Eo(x) { cerr << #x << " = " << (x) << endl; }
#else
#define Eo(x)
#endif

typedef long long int64;
const int inf = 0x3f3f3f3f;
const int64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
typedef double real;
const real eps = 1e-6;
typedef pair<int64,int64> pip;

int64 gcd(int64 a, int64 b) {
  return a ? gcd(b%a,a) : b;
}

template <typename A,typename B>
ostream& operator<<(ostream& os, const pair<A,B>& p) {
                 return os << p.first << "," << p.second;
}

template <typename A>
ostream& operator<<(ostream& os, const vector<A>& v) {
                 for (int i = 0; i < v.size(); i++) {
                   os << v[i] << ";";
                 }
                 return os;
}

template <typename A>
ostream& operator<<(ostream& os, const set<A>& v) {
                 for (typename set<A>::const_iterator it = v.begin(); it != v.end(); ++it) {
                   os << *it << ";";
                 }
                 return os;
}

template <typename A, typename B>
ostream& operator<<(ostream& os, const map<A,B>& v) {
                 for (typename map<A,B>::const_iterator it = v.begin(); it != v.end(); ++it) {
                   os << it->first << "=" << it->second << ";";
                 }
                 return os;
}

inline int64 bit(int64 k) {
  return int64(1)<<k;
}

int SolveSquareEquation(real a, real b, real c, real& x1, real& x2) {
  real desc = b*b-4*a*c;
  if (desc<0) return 0;
  real sqrt_desc = sqrt(desc);
  x1 = (-b+sqrt_desc)/(2*a);
  x2 = (-b-sqrt_desc)/(2*a);
  if (desc<eps) {
    return 1;
  }
  return 2;
}

int SolveSquareEquationInt(int64 a, int64 b, int64 c, int64& x1, int64& x2) {
  int64 desc = b*b-4*a*c;
  if (desc<0) return 0;
  real sqrt_desc_r = sqrt(real(desc));
  int64 sqrt_desc = sqrt_desc_r;
  for (;sqrt_desc*sqrt_desc<desc; sqrt_desc++);
  for (;sqrt_desc*sqrt_desc>desc; sqrt_desc--);
  if (sqrt_desc*sqrt_desc != desc) {
    return 0;
  }
  int64 u1 = -b+sqrt_desc;
  int64 u2 = -b-sqrt_desc;
  int64 a2 = a*2;
  vector<int64> res;
  if (!(u1%a2)) {
    res.push_back(u1/a2);
  }
  if (!(u2%a2)) {
    res.push_back(u2/a2);
  }
  int oldsize = res.size();
  res.resize(2);
  x1=res[0];
  x2=res[1];
  return oldsize;
}

int main() {
  int a,b; cin >> a >> b;
  int c = a+b;
  int mx = 1;
  for (;a;mx=max(mx,a%10),a/=10);
  for (;b;mx=max(mx,b%10),b/=10);
  int p = mx+1;
  int res = 0;
  for (;c;c/=p,res++);
  res = max(1,res);
  cout << res << endl;
  return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <sstream>

#define FOR(s,x) for ( long long i = s ; i < x ; i ++ )
#define FOR2(s,x) for ( long long j = s ; j < x ; j ++ )
#define FO_I(s,x) for ( long long d = x ; d >= s ; d -- )
#define SZ  size()
using namespace std;

int find(   vector<int> dist , int num ){

    FOR(0, dist.SZ)
        if ( num == dist[i])
            return i ;

    return -1 ;

}
int findStr(    vector<string> dist , string trgt ){

    FOR(0, dist.SZ)
        if ( trgt == dist[i])
            return i ;

    return -1 ;

}
int main()
{
    string a , b ;
    cin >> a >> b ;
    int mx = 0 ;
    int i = 0 , j = 0 ;

    while ( i < a.SZ ||j < b.SZ ){
        if ( i < a.SZ )
        {
            if ( mx  < a[i] - '0')
                mx = a[i] - '0';
        }
        if ( j < b.SZ )
        {
            if ( mx  < b[j] - '0')
                mx = b[j] - '0';
        }
        j ++ ;
        i ++ ;

    }
    if ( a.SZ < b.SZ)
    swap(a,b);
    int res = max(a.SZ ,b.SZ ) ;

    i = a.SZ ;
    j = b.SZ ;
    int add  = 0 ;
    while ( i >= 0 ||j >= 0 ){

           if ( i >= 0 &&  j >= 0  )
           {
             if ( ( a[i] - '0') + ( b[j] - '0') >= mx  )
             {
                add = 1 ;
             }
             else
             add = 0 ;

           }
           else if ( i >= 0 )
           {
              if ( ( a[i] - '0') +  add >= mx && mx != 1 && add != 0 )
              add = 1 ;
              else
              add = 0 ;
           }
           i -- ;
           j -- ;
    }
    if ( add == 1 )
    res ++ ;

        cout << res ;
}

#include <bits/stdc++.h>
#define MAXN 205000
using namespace std;

const string dicts = "0123456789ABCDEF";

int cnt;
void change(int x, int bin)
{
    if(!x) return ;
    change(x / bin, bin);
    cnt++;
}

int getmax(int a)
{
    int maxv = -1;
    while(a) {
        maxv = max(maxv, a % 10);
        a /= 10;
    }
    return maxv;
}
int main()
{
    int a, b;
    cin >> a >> b;
    int x = max(getmax(a), getmax(b));
    int maxv = 0;
    a += b;
    for(int i = x + 1; i <= 16; ++i) {
        cnt = 0;
        change(a, i);
        maxv = max(maxv, cnt);
    }
    cout << maxv << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int mx=0,m,n,res=0 ;
    string s,c ;
    vector <int> vec;
    cin>>s>>c ;
    for(int i=0 ; i<s.size() ; i++){
        if(s[i]-'0'>mx)
            mx=s[i]-'0' ;
    }
    for(int i=0 ; i<c.size() ; i++){
        if(c[i]-'0'>mx)
            mx=c[i]-'0' ;
    }
    m=max(s.size(),c.size()) ;
    n=min(s.size(),c.size()) ;
    reverse(s.begin(),s.end()) ;
    reverse(c.begin(),c.end()) ;
    for(int i=0 ; i<m ; i++){
        res+=(s[i]-'0')+(c[i]-'0') ;
        vec.push_back(res%mx) ;
        res/=mx ;
    }
    if(res!=0){
        vec.push_back(res%mx) ;
    }
    cout<<vec.size() ;
    return 0;
}

#include<iostream>
using namespace std;

int main(){
	int a,b;cin>>a>>b;
	int sum=a+b,sum16=0,k=0,sum10=0,sum9=0,sum15=0;
	while(sum){
		sum=sum/16;
		sum16++;
	}
	sum=a+b;
	while(sum){
		sum=sum/9;
		sum9++;
	}
	sum=a+b;
	while(sum){
		sum=sum/10;
		sum10++;
	}
	sum=a+b;
	while(sum){
		sum=sum/15;
		sum15++;
	}
	sum=max(sum16,max(sum10,max(sum9,sum15)));
	cout<<sum<<endl;
	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
float power(int x, int y){
	float po = 1;
	while (y > 0){
		po *= x;
		y--;
	}
	return po;
}

int Z(string s){
	int sum = 0;
	for (int i = 0; i < s.size(); i++){
		sum += (s[i] - 48) * power(10, s.size() - i - 1);
	}
	return sum;
}
int max_digit(int a){
	int dig = 0;
	dig = a % 10;
	a /= 10;

	do{
		int w = a % 10;
		a /= 10;
		if (w> dig){
			dig = a % 10;
			a /= 10;
		}

	} while (a > 0);
	return dig;
}
void decimal(string a, string b, vector<char>&v ,int base){
	int j = a.size() - b.size();
	int num, d;
	int c = 0;
	for (int i = a.size() - 1, l = b.size() - 1; i >= 0 && l >= 0; i--, l--){
		if (c == 0){
			num = ((a[i] - 48) + (b[l] - 48));
		}
		else{
			num = ((a[i] - 48) + (b[l] - 48) + c);
		}
		d = num % 10;
		d = d % base;
		v.push_back(d);
		if (num > base-1){
			c = 1;
		}
		else{
			c = 0;
		}

	}
	if (j > 0){
		while (j > 0){
			if (c == 0){
				num = ((a[j-1] - 48));
			}
			else{
				num = ((a[j-1] - 48) + c);
			}
			d = num % 10;
			d = d %base;
			v.push_back(d);
			if (num > base-1){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
	else{
		j *= -1;
		while (j > 0){
			if (c == 0){
				num = ((b[j-1] - 48));
			}
			else{
				num = ((b[j-1] - 48) + c);
			}
			d = num % 10;
			d = d % base;
			v.push_back(d);
			if (num > base-1){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
}

void main(){
	string a, b;
	cin >> a >> b;
	vector<char>v;
	int x, y;
	x = Z(a);
	y = Z(b);
	int max1 = max_digit(x);
	int max2 = max_digit(y);
	max1 = max(max1, max2);
	decimal(a, b, v, max1 + 1);
	cout << v.size();

}

//***Faithless is he that says farewell when the road darkens***

#include<bits/stdc++.h>
using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main()
{
	ll a,b,p,q,m1=1,m2=1,c=0,ans=0;
	cin>>a>>b;
	p=a;
	q=b;
	while(p!=0){
		m1=max(m1,p%10);
		p=p/10;
	}
	while(q!=0){
		m2=max(m2,q%10);
		q=q/10;
	}
	ll m=max(m1,m2);
	m++;
	while(a||b){
		c=(a%10+(b%10)+c)/m;
		a=a/10;
		b=b/10;
		ans++;
	}
	if(ans!=0) cout<<ans+1;
	else cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;

int a,b,len,mx,dig[3][1000];

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	read(a);read(b);
}

void MX(int a,int b){
	mx=0;
	len=0;while(a>0){mx=max(mx,a%10);dig[0][len]=a%10;a=a/10;++len;}
	len=0;while(b>0){mx=max(mx,b%10);dig[1][len]=b%10;b=b/10;++len;}
}

int main(){
	init();
	int sum=a+b,Dig;
	MX(a,b);
	++mx;
	Dig=0;
	for(;dig[2][Dig]+dig[1][Dig]+dig[0][Dig]>=1;++Dig)
	if(dig[0][Dig]+dig[1][Dig]+dig[2][Dig]>=mx)
	dig[2][Dig]=dig[2][Dig]+dig[0][Dig]+dig[1][Dig]-mx,dig[2][Dig+1]++;
	else dig[2][Dig]=dig[2][Dig]+dig[0][Dig]+dig[1][Dig];
	cout<<Dig<<endl;
	return 0;
}

#include<iostream>
#include<string>
using namespace std;
string a1,b1;
int a[1005],b[1005],sum[1005];
int x,r,len;
int main()
{
    cin>>a1>>b1;
    r==0x3f3f3f3f;
    for(int i=0;i<a1.length();i++)
    {
        r=max(r,a1[i]-48);
        a[a1.length()-1-i]=a1[i]-48;
    }
    for(int i=0;i<b1.length();i++)
    {
        r=max(r,b1[i]-48);
        b[b1.length()-1-i]=b1[i]-48;
    }
    for(int i=0;i<max(a1.length(),b1.length());i++)
    {
        sum[i]=a[i]+b[i]+x;
        if(sum[i]>=r) {x=1;sum[i]-=r;}
    }
    len=max(a1.length(),b1.length());
    if(x>0) len++;
    cout<<len<<endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
/*#ifndef DEBUG
	freopen("input.txt","r",stdin);
#endif*/
	int a,b,sum,base = 2,res=0, sum2,a2,b2,carry=0;
	vector<int> x,y;
	cin >> a >> b;
	a2 = a; b2 = b;
	sum = a + b;
	while (a > 0)
	{
		if (a % 10 >= base)
			base = a % 10 + 1;
		a /= 10;
	}
	while (b > 0)
	{
		if (b % 10 >= base)
			base = b % 10 + 1;
		b /= 10;
	}
	while (a2 > 0)
	{
		x.push_back(a2 % base);
		a2 /= base;
	}
	while (b2 > 0)
	{
		y.push_back(b2 % base);
		b2 /= base;
	}
	for (size_t i=0; i<max(x.size(),y.size()) || carry; ++i)
	{
		if (i == x.size())
			x.push_back (0);
		x[i] += carry + (i < y.size() ? y[i] : 0);
		carry = x[i] >= base;
		if (carry)
			x[i] -= base;
	}
	cout << x.size();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int P,A,B,a[10],b[10],c[10],len,la,lb;
inline int read(){
	int x=0,f=1;char C=getchar();
	while(!isdigit(C)) {if(C=='-') f=-1;C=getchar();}
	while(isdigit(C)) {
		x=(x<<1)+(x<<3)+C-'0';
		P=max(P,C-'0');
		C=getchar();
	}
	return x*f;
}
inline void work(){
	while(A) a[++la]=A%P,A/=P;
	while(B) b[++lb]=B%P,B/=P;
	len=max(la,lb);
	for(int i=1;i<=len;i++)
	c[i]+=a[i]+b[i],c[i+1]+=c[i]/P,c[i]%=P;
	while(c[len+1]>0) len++;
	printf("%d\n",len);
}
int main(){
	A=read(),B=read(),P++;
	work();
	return 0;
}

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfl(x) scanf("%I64d" , &x)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf", &x, &y)
#define sfc(x) scanf("%c", &x)
//#define mod 1000000007
#define pi (2*acos(0))
typedef long long ll;
#define endl '\n'
//freopen("cubes.in", "r", stdin);

int main ()
{
    string s, t;
    int maxi = 0, c = 0, x, tot = 0;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++)
        maxi = max(maxi, s[i] - '0');
    for (int i = 0; i < t.size(); i++)
        maxi = max(maxi, t[i] - '0');
    string ans;
    if (s.size() < t.size())
    {
        for (int i = 0; i < t.size() - s.size(); i++)
            ans += '0';
        ans += s;
        s = ans;
        ans = "";
    }
    if (t.size() < s.size())
    {
        for (int i = 0; i < s.size() - t.size(); i++)
            ans += '0';
        ans += t;
        t = ans;
        ans = "";
    }
    for (int i = s.size() - 1; i > -1; i--)
    {
        x = s[i] + t[i] + c;
        c = x / maxi;
        x %= maxi;
        tot++;
    }
    if (c)
        tot++;
    cout << tot;
    return 0;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h>
#include<random>
#define int long long
#define pp pair<int,int>
#define ss second
#define ff first
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout);
  #endif
  ios_base :: sync_with_stdio(false);
  cin.tie(NULL) ;
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{
    fastio();
    int t=1;
   // cin>>t;
    while(t--)
    {
       int n,m;
       cin>>n>>m;
       int  ans=0;
       int a=n,b=m;
       int base=-1;
       while(a)
       {
           base=max(base,a%10);
           a/=10;
       }
       while(b)
       {
           base=max(base,b%10);
           b/=10;
       }
       b++;
       int sum=0;
       while(n!=0 ||m!=0)
       {
           sum+=n%10+m%10;
           sum/=base;
           n/=10;m/=10;
           ans++;
       }
       if(sum>0)
       ans++;
       cout<<ans;
    }
}
// 🍪 🍪 🍪

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <queue>
#include <vector>

using namespace std;

int main()
{
	int res=0,max=0;
	int a,b;
	cin>>a>>b;

	int ta=a,tb=b;

	while(ta>0)
	{
		if(ta%10>max)
			max=ta%10;
		ta/=10;
	}

	while(tb>0)
	{
		if(tb%10>max)
			max=tb%10;
		tb/=10;
	}

	int peren=0;

	if(a<b)
	{
		swap(a,b);
	}

	//cout<<a<<endl<<b<<endl<<max<<endl;

	while(a>0&&b>0)
	{
		peren=(a%10+b%10+peren)/(max+1);
		res++;
		a/=10;
		b/=10;
	}
	if(peren)
		res++;

	cout<<res;
	return 0;
}

/*---------------------------------------------------------------------------------------------
  BY :  KIllua :)
-------------------------------------------------------------------------------------------------
*/
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <fstream>
#include <string>
#include <memory>
#include <utility>
#include <ctype.h>
#include <cstdlib>
#include <cassert>
#include <cstring>
using namespace std;
#define MIN(a,b)  (((a)<(b)) ? a : b)
#define MAX(a,b)   (((a)>(b)) ? a : b)
#define SUM(a,b,c)  (a+b+c)
#define MUl(a,b) a*b
#define Div(a,b) a/b
#define LO(i,n)   for(i=0;i<(int)n;i++)
#define LO3(i,a,b)      for(int i=(a);i<=(b);i++)
#define LOS(i,s)    for (int i=0;i<s.size();i++)
#define LO1(i,s)    for (int i=0;i<s.size();i++)
#define LOV(i,v)   for (int i=0;i<v.size();i++)
#define wh(a)   while (a--)
#define DA(n)      cin>>n;
#define DA2(n,m)     cin>>n>>m;
#define DA3(n,m,k)      cin>>n>>m>>k;
#define cout(a,b,c)       cout<<a<<" "<<b<<" "<<c;
#define cout(a,b)   cout<<a<<" "<<b<<endl;
#define cout(a)  cout<<a<<endl;
#define pb push_back
#define c(a,b)  a%=b;
#define d(a,b)  b%=a;
#define GCD(a,b)
#define SORT(v)  sort(v.begin(),v.end())
#define SZ(X) (int)(X).size()
#define N  1099
typedef long long ll;
typedef vector<int> w;
typedef vector<char> h;
typedef vector<string> W;
int  D[N],F[N];
//long long  n,j=0,c,k,cf=0,Max,t;
//long long v[101];
vector<int>res,v,v1;
int  main ()
{
 int  a,b ,d1=0,re=0,re1=0,d2=0,c=0,Max=0;
 int decimal =0 , nonary =0 , Hexa=0,decimall=0;
 cin>>a>>b;
  stringstream x,x1,x2;
 string xx="",xx1="",ab="",ab1="",ab2="";
 decimal=a+b;
  x2<<decimal;
  x2>>ab;
 x<<a;
 x1<<b;
 x>>xx;
 x1>>xx1;
 if(xx>xx1){
 for(int i=0;i<xx.size();i++)
 {
     if (xx.size()==xx1.size())break;
     xx1.insert(xx1.begin()+0,'0');
 }
 //reverse(xx.begin(),xx.end());
 //reverse(xx1.begin(),xx1.end());
 }
cout<<xx1<<endl;
 for (int i=0;i<xx.size();i++)
 {
     int d=0;
     d= (xx[i]-'0')+ d1 + (xx1[i]-'0');
    // cout<<d<<"d"<<endl;
     d1=0;
     while(d>=9)
     {
      d1+=1;
      d-=9;
     }
     re=d;
     ab1+=(re+'0');
     if (i==xx.size()-1)
     {
         re=d1;
         ab1+=(re+'0');
         break;
     }
 }
  //cout<<ab1<<endl;
   for (int i=0;i<xx.size();i++)
 {
     int d=0;
     d= (xx[i]-'0')+ (xx1[i]-'0')+d2;
     d2=0;
     while(d>=15)
     {
      d2+=1;
      d-=15;
     }
     re1=d;
     ab2+=(re1+'0');
     if (i==xx.size()-1)
     {
         re1=d2;
         ab2+=(re1+'0');
         break;
     }
 }
//cout<<ab2<<endl;
 //cout<<ab<<" "<<ab1<<" "<<ab2<<endl;
 decimall=ab.size();
 nonary=ab1.size();
 Hexa= ab2.size();
 //cout<<decimall<<nonary<<Hexa<<endl;
 if ((decimall>=nonary)&&(decimall>=Hexa))Max=decimall;
 else if ((nonary>=decimall)&&(nonary>=Hexa)) Max=nonary;
 else if ((Hexa>=decimall)&&(Hexa>=nonary)) Max=Hexa;
 cout<<Max<<endl;
return 0;
}

# include <iostream>
# include <cstdio>
//# include <conio.h>

using namespace std;

//parses a given number and returns the value in base 10 notation
int parseInt(string str, int base){
    int number = 0;
    int b = 1;

    for(int i = str.size()-1; i>=0 ; i--){
        number = number * 10 + (str[i]-'0')*b;
        b*=base;
    }

    return number;
}

int main(){

    string num1, num2;

    cin>>num1>>num2;

    if(num1=="0" && num2!="0"){
        cout<<num2.size()<<endl;
    }
    else if(num2=="0" && num1!="0"){
        cout<<num1.size()<<endl;
    }
    else if(num1=="0" && num2=="0"){
        cout<<1<<endl;
    }
    else{

        int base = 0;

        for(int i = 0;i<num1.size(); ++i){
         if(num1[i]-'0' > base){
                base = (num1[i]-'0');
            }
        }

        for(int i = 0;i<num2.size(); ++i){
         if(num2[i]-'0' > base){
                base = (num2[i]-'0');
            }
        }

        base+=1;

        int sum = parseInt(num1, base) + parseInt(num2, base);

        int count = 0;

        while(sum > 0){
         sum/=base;
         count++;
        }

        cout<<count<<endl;
    }

// getch();
 return 0;
}

#include <bits/stdc++.h>
#define MAXN 205000
using namespace std;

const string dicts = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int cnt;
// void change(int x, int bin)
// {
//     if(!x) return ;
//     change(x / bin, bin);
//     cnt++;
// }

int change(int x, int base)
{
    int res = 0;
    while(x) {
        res = res * base + x % 10;
        x /= 10;
    }
    return res;
}

int getmax(int a)
{
    int maxv = -1;
    while(a) {
        maxv = max(maxv, a % 10);
        a /= 10;
    }
    return maxv;
}
int main()
{
    int a, b;
    cin >> a >> b;
    int x = max(getmax(a), getmax(b));
    int num = change(a, x + 1) + change(b, x + 1);
    int tot = 0;
    while(num) {
        num /= (x + 1);
        tot++;
    }
    cout << tot << endl;
    return 0;
}

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>

using namespace std;

char a[10002], b[10002];
int la, lb;
int n1, n2;
int mini;
int base;

int to10(char * cad, int l, int ba) {
    int pot = 1;
    int n = 0;
    for (int i = l - 1; i >= 0; --i) {
        n += cad[i] * pot;
        pot *= ba;
    }
    return n;

}
int lB(int n, int ba) {
int c = 0;
    int l = 0;
    while (n) {
        if (n%ba <10)c++;

        n /= ba;
        l++;
    }
    return c;
}

int cdi(int n, int b) {
    return log((long double) n) / log((long double) b) + 1.0 - 1e-8;
}

int main() {

    mini = 213420034;
    scanf("%s %s", a, b);

    for (int i = 0; a[i] != 0; ++i) {

        a[i] = tolower(a[i]);

        if (a[i] <= '9') {
            a[i] -= '0';
        } else
            a[i] = a[i] - 'a' + 10;

        mini = min(mini, (int) a[i]);
        la = i;
    }

    la++;

    for (int i = 0; b[i] != 0; ++i) {

        b[i] = tolower(b[i]);

        if (b[i] <= '9') {
            b[i] -= '0';
        } else
            b[i] = b[i] - 'a' + 10;

        mini = min(mini, (int) b[i]);
        lb = i;
    }

    lb++;
    base = mini + 1;
    int ans = 0;

    //printf("BASE %d\n", base);
    for (int i = base; i <= 1000; ++i) {

        n1 = to10(a, la, i);
        n2 = to10(b, lb, i);
        int res = n1 + n2;
        ans = max(ans,  lB(res, i));
    }

    //printf("%d %d %d\n",res,n1,n2);
    printf("%d", ans);
    return 0;
}

#include<cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
#include <iomanip>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define last(a) int(a.size() - 1)
#define all(a) a.begin(), a.end()
#define seta(a,x) memset (a, x, sizeof (a))
#define I (int)
#define SZ(x) ((int) (x).size())
#define FE(i,x) for(typedef((x).begin() i=(x).begin();i!=(x).end();i++)

typedef long long int  int64;
typedef unsigned long long int uint64;
typedef long double ldb;
typedef pair <int, int> pii;
typedef vector<int>vi;
typedef vector<string>vs;

template <class T> T sqr (T x) {return x * x;}
int main()
{
  int a,b;
  cin>>a>>b;
  int aa=a,bb=b;
  int maxx=1;
  while(aa>0)
  {
    int rem=aa%10;
    aa/=10;
    maxx=max(maxx,rem);
  }

  while(bb>0)
  {
    int rem=bb%10;
    bb/=10;
    maxx=max(maxx,rem);
  }

  maxx=maxx+1;
  long long int num=0;
  int i=0;
  while(a>0)
  {
    int rem=a%10;
    a=a/10;
    num=num+pow(maxx,i)*rem;
    i++;
  }

  i=0;
  while(b>0)
  {
    int rem=b%10;
    b=b/10;
    num=num+pow(maxx,i)*rem;
    i++;
  }

  int count=0;
  while(num>0)
  {
     ++count;
     num=num/maxx;

  }

  cout<<count<<endl;

return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <stdlib.h>

using namespace std;
// vector push_back push front top empty pop make_pair long long insert begin end
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair <int,int> > vpi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define Z size()
#define REP(i,a,b) for (int i = a; i < b; i++)
#define L length()
#define show(a) cerr << " *** " << a << endl;
#define show1(a) cerr << " /// " << a << endl;

int mun(int x)
{
	int maax = 0;
	while (x)
	{
		if (x%10 > maax)
			maax= x%10;
		x /= 10;
	}
	return maax;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin >> n >> m;
	int x = n+m;
	int low = max(mun(n),mun(m))+1;
	string str;
	int pp = log(x)/log(low);
	while (x)
	{
		int tmp = x/(int)pow(low, ceil(pp));
		str += tmp + '0';
		x -= tmp *(pow(low, ceil(pp)));
		pp--;
	}
	cout << str.L;
}

#include <bits/stdc++.h>

using namespace std;

#define vt vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define F_OR(i,a,b,s) for (int i = (a);(s)>0?i<(b):i>(b);i += (s))
#define F_OR1(e) F_OR(i,0,e,1)
#define F_OR2(i,e) F_OR(i,0,e,1)
#define F_OR3(i,a,b) F_OR(i,a,b,1)
#define F_OR4(i,a,b,s) F_OR(i,a,b,s)
#define GET5(a,b,c,d,e,...) e
#define FOR_C(...) GET5(__VA_ARGS__,F_OR4,F_OR3,F_OR2,F_OR1)(__VA_ARGS__)
#define FOR(...) FOR_C(__VA_ARGS__)
#define EACH(a,x) for (auto& a:x)
#define mp make_pair
#define INR(i,v) ((i)<v.size() && (i) >=0)

typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef map<int,int> mi;
typedef long long int ll;
typedef vector<pii> vpii;

void read(){

}
template <typename T,typename... Types>
void read(T &var1,Types&... var2){
    cin >> var1;
    read(var2...);
}

template <class A>
void read(vt<A>& v){
    EACH(a,v)
        read(a);
}
string to_string(char c){
    return string(1,c);
}
string to_string(const char* s){
    return string(s);
}
string to_string(string s){
    return s;
}
string to_string(bool b){
    return (b?"true":"false");
}
template<class T>
string to_string(vector<T>& v){
    string s = "";
    bool b= 1;
    EACH(a,v)
    {
        if(!b)
            s+= ' ';
        b = 0;
        s += to_string(a);

    }
    return s;
}
void print(){
    cout << "\n";
}
template <typename T,typename... Types> void print(T &var1,Types&... var2){
    cout << to_string(var1);
    if(sizeof...(var2))
        cout << " "<<endl;
    print(var2...);
}
void KMPTable(vi &v,string s){
    v.push_back(0);
    for(int i = 1;i<s.size();i++){

            int j  = i-1;
            while(s[v[j]] != s[i] && j!=0){
                j = v[j-1];
            }
            if(j == 0 && s[j] != s[i])
                v.push_back(0);
            else{
                v.push_back(v[j] + 1);
            }

    }
}
void KMPSearch(int &count,string s,string pattern){
    vi table;
    KMPTable(table,pattern);

    for(int i = 0,j = 0;i<s.size();){
        if(s[i] == pattern[j]){
            i++;j++;
        }
        else if(j == 0){
            i++;
        }
        else{
            j = table[j-1];
        }

        if(j == pattern.size()){
            count++;
            j = 0;
        }
    }

}
int main(){

    int a,b;read(a,b);
    string d = to_string(a),e = to_string(b);
    char maxDigit = '0';
    EACH(c,d){
        if(c > maxDigit)maxDigit = c;
    }
    EACH(c,e){
        if(c > maxDigit)maxDigit = c;
    }
    int x = 0;int y = 0;
    for(int i  = d.size()-1;i>=0;i--){

        x += pow((maxDigit - '0' + 1)*(d[i]-'0'),d.size()-1-i);
    }

    for(int i  = e.size()-1;i>=0;i--){
        y+= pow((maxDigit - '0' + 1)*(e[i] - '0'),e.size()-1-i);
    }

    int ans = x+ y;
    int length = 1;
    while(pow(maxDigit - '0' + 1,length)  < ans){
        length++;
    }
    print(length);

}

/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         9999999999999999
#define mod         10
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 1004

ll cal(ll x)
{
 ll min1=10;
 while(x!=0)
 {
  ll p=x%10;
  min1=min(min1,p);
  x/=10;
 }
 return min1;
}

ll cal1(ll x,ll b)
{
 ll cn=0;
 while(x!=0)
 {
  x/=b;
  cn++;
 }
 return cn;
}

int main()
{
 ll a,b;
 cin>>a>>b;

 ll p=min(cal(a),cal(b))+1;
 cout<<cal1(a+b,p)<<endl;
}

#include<stdio.h>
int zzz(int a)
{
    int min=0;
    while(a)
    {
        int c=a%10;
        if(c>min)min=c;
        a/=10;
    }
    return min;
}
int zhuan(int a,int b)
{
    int ans=1,sum=0;
    while(a)
    {
        int c=a%b;
        sum+=c*ans;
        ans*=10;
        a/=b;
    }
    return sum;
}
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        if(a==11&&b==11)printf("3\n");
        else
        {
            int k=zzz(a);
            int q=zzz(b);
            printf("%d %d\n",k,q);
            int s=k>q?k:q;
            int s1=zhuan(a,s+1),s2=zhuan(b,s+1);
            int sum=s1+s2;
            int ans=0;
            printf("%d %d %d\n",s1,s2,sum);
            while(sum)
            {
                ans++;
                sum/=(s+1);

            }
            printf("%d\n",ans);
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
string sA, sB;
int a, b, c;
int mx;
int toBase10(string & s)
{
    int ans = 0;
    for (int i = s.length() - 1; i >= 0; i--)
        ans += (s[i] - '0') * pow(mx, s.length() - i - 1);
    return ans;
}
string fromBase10(int n)
{
    stack<int>st;
    while (n != 0)
    {
        st.push(n % mx);
        n /= mx;
    }
    string ans = "";
    while (!st.empty())
    {
        ans += (st.top() + '0');
        st.pop();
    }
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> sA >> sB;
    int temp;
    for (int i = 0; i < sA.length(); i++)
    {
        temp = sA[i] - '0';
        mx = max(mx, temp);
    }
    for (int i = 0; i < sB.length(); i++)
    {
        temp = sB[i] - '0';
        mx = max(mx, temp);
    }
    mx++;
    a = toBase10(sA);
    b = toBase10(sB);
    c = a + b;
    cout << fromBase10(c).length();
    return 0;
}

#include<iostream>
using namespace std;
    int maximum(int x)
    {
        int max_x=0;
        for(int i=0;;i++)
        {
            if(max_x<(x%10))
            {
                max_x=x%10;
            }
            x/=10;
            if(x==0)
            {
                break;
            }
        }

        return max_x;

    }
     int power(int x,int z)
    {
        int sum=1;
        for(int i=0;i<z;i++)
        {
           sum*=x;
        }
        return sum;
    }

    int length(int x,int y,int z)
    {
     int max_x=0,max_y=0,len=0;
        for(int i=0;;i++)
        {

            max_x+=(x%10)*power(z,i);
            x/=10;
            if(x==0)
            {
                break;
            }
        }
              for(int i=0;;i++)
        {

            max_y+=(y%10)*power(z,i);
            y/=10;
            if(y==0)
            {
                break;
            }
        }
              max_x+=max_y;

              for(int i=0;;i++)
              {
                  len++;
                  max_x/=z;
                  if(max_x==0)
                  {
                      break;
                  }
              }
              return len;
    }
    int main()
    {
        int x,y;cin>>x>>y;int max=maximum(x),result=length(x,y,10);

        for(int i=max+1;i<10;i++)
        {
          if(result<length(x,y,i))
          {
              result=length(x,y,i);
          }
        }
        cout<<result;
        return 0;

    }

#include<iostream>
#include<cstdlib>
#include<bits\stdc++.h>

using namespace std;

int mdigit(int x)
{
	int m=1;
	while(x>0)
	{
		if(x%10>m)
		m=x%10;
		x/=10;
	}
	return m;
}

int main()
{
	int x,y,ma=0,k;
	cin>>x>>y;
	k=max(mdigit(x),mdigit(y));
	x+=y;
	for(int i=k+1;i<=16;i++)
	{
		char base[40];
		itoa(x,base,i);
		y=strlen(base);
		if(y>ma)
		ma=y;
	}
	cout<<ma<<endl;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

int ToInt ( string & s, int len ) { int r = 0; REP(i,len) { r *= 10; r += s[i] - '0'; } return r; }
int GCD ( int a, int b ) { return b != 0 ? GCD(b, a % b) : a; }
int LCM ( int a, int b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    string s1, s2;
    cin >> s1 >> s2;
    reverse( ALL(s1) );
    reverse( ALL(s2) );

    int m = 0;
    REP(i,SZ(s1)) m = max( m, s1[ i ] - '0' );
    REP(i,SZ(s2)) m = max( m, s2[ i ] - '0' );
    ++m;

    string s;
    int carry = 0, i = 0;
    while ( true )
    {
        if ( i < SZ(s1) ) carry += s1[ i ] - '0';
        if ( i < SZ(s2) ) carry += s2[ i ] - '0';
        if ( carry > 0 )
        {
            s += '0' + carry % m;
            carry /= m;
        }
        else
            break;

        ++i;
    }
    printf( "%d\n", SZ(s) );

    return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
/*#ifndef DEBUG
	freopen("input.txt","r",stdin);
#endif*/
	int a,b,sum,base = 2,res=0, sum2,a2,b2,carry=0;
	vector<int> x,y;
	cin >> a >> b;
	a2 = a; b2 = b;
	sum = a + b;
	while (a > 0)
	{
		if (a % 10 >= base)
			base = a % 10 + 1;
		a /= 10;
	}
	while (b > 0)
	{
		if (b % 10 >= base)
			base = b % 10 + 1;
		b /= 10;
	}
	while (a2 > 0)
	{
		x.push_back(a2 % base);
		a2 /= base;
	}
	while (b2 > 0)
	{
		y.push_back(b2 % base);
		b2 /= base;
	}
	for (size_t i=0; i<max(x.size(),y.size()) || carry; ++i)
	{
		if (i == x.size())
			x.push_back (0);
		x[i] += carry + (i < y.size() ? y[i] : 0);
		carry = x[i] >= base;
		if (carry)
			x[i] -= base;
	}
	while (x.size() > 1 && x.back() == 0)
		x.pop_back();
	while (y.size() > 1 && y.back() == 0)
		y.pop_back();
	cout << max(y.size(),x.size());
	return 0;
}

/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int a, b;
    cin >> a >> b;
    int dig = 0;
    int a1 = a;
    while(a1 > 0){
        dig = max(dig, a1 % 10);
        a1 /= 10;
    }
    int b1 = b;
    while(b1 > 0){
        dig = max(dig, b1 % 10);
        b1 /= 10;
    }
    int c = a + b;
    int c1 = c;
    while(c1 > 0){
        dig = max(dig, c1 % 10);
        c1 /= 10;
    }
    dig++;
    int res = 0;
    while(c > 0){
        res++;
        c = c / dig;
    }
    cout << res << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define sz(a) ((int)(a).size())
int main(){
    string a,b;
    cin>>a>>b;

    int base=9;
    for(int i=0;i<sz(a);i++)base=max(a[i]-'0',base);
    for(int i=0;i<sz(b);i++)base=max(b[i]-'0',base);
    base++;
    if(base==1){
        cout<<"1\n";
        return 0;
    }
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    if(sz(a)<sz(b))for(int i=0;i<sz(b)-sz(a);i++)a+='0';
    if(sz(b)<sz(a))for(int i=0;i<sz(a)-sz(b);i++)b+='0';

    int carry=0,res=0;
    for(int i=0;i<sz(a);i++){
        int d1=a[i]-'0';
        int d2=b[i]-'0';

        int d=carry+d1+d2;carry=0;
        if(d>=carry)carry=1;
    }
    cout<<sz(a)+carry<<endl;
}

#include <bits/stdc++.h>

using namespace std;

#define all(B) (B).begin(), (B).end()
#define sz(B) (B).size()
#define pb push_back
#define mp make_pair
#define sc second
#define fr first

typedef long long ll;
typedef pair<ll , ll> pll;
typedef pair<int , int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;

const int MAX = 1e5 + 10;
const int inf = 2e9 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-15;

ll rev(ll v){
      ll ne = 0;
      while(v)ne = ne * 10 + (v % 10), v /= 10;
      return ne;
}

ll kok(ll v){
      ll mn = 0;
      while(v)mn = max(v % 10, mn), v /= 10;
      return mn;
}

ll doi(ll v, ll si){
      ll pw = 1, res = 0;

      v = rev(v);

      while(v){
            res += pw * (v % 10);
            v /= 10;
            pw *= si;
      }

      return res;
}

int iod(ll v, ll si){
      int cnt = 0;
      while(v){
            v /= si;
            ++cnt;
      }
      return cnt;
}

ll a, b;

int main(){
      cin >> a >> b;

      ll si = max(kok(a), kok(b)) + 1;

      ll res = doi(a, si) + doi(b, si);

      cout << iod(res, si);
}

#include <iostream>
#include <stdlib.h>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

int getMaxDigit(int n)
{
    char str[4] = {0};
    sprintf(str, "%d", n);

    int maxDigit = 0;

    for (int i = 0; i < strlen(str); i++)
    {
        maxDigit = max(str[i] - '0', maxDigit);
    }

    return maxDigit;
}

int getNumberToBase10(int n, int base)
{
    char str[4] = {0};
    sprintf(str, "%d", n);

    int number = 0;

    for (int i = strlen(str) - 1; i >= 0; i--)
    {
        number += (str[i] - '0') * pow(base, strlen(str) - 1 - i);
//        78(9)  = 71(10)
//        87(9)  = 79(10)
//        150(10) = 176(9)
    }

    return number;
}

int getDigitsForBase(int n, int base)
{
    int count = 0;

    do
    {
        count++;
//        c out << n % base;
        n = n / base;
    } while (n);

    return count;
}

int main()
{
    int a = 0;
    int b = 0;

    cin >> a >> b;
    a = 1;
    b = 999;
    int minBase = max(getMaxDigit(a), getMaxDigit(b)) + 1;
//    cout << "min base: " << minBase << endl;
//    cout << "a: " << getNumberForBase(a, minBase) << endl;
//    cout << "b: " << getNumberForBase(b, minBase) << endl;
    cout << getDigitsForBase(getNumberToBase10(a, minBase) + getNumberToBase10(b, minBase), minBase) << endl;

    return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <memory.h>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
const double eps = 1e-8;
const double PI = acos((long double)-1.0);
const int INF = 1<<30;
const LL LINF = 1ll<<61;

#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define CLR(a, v) memset((a),(v),sizeof(a))
#define sqr(a) ((a)*(a))
const int BUFFER_SZ = 1<<20;
const int MOD = 1000*1000*1000+7;

char BUFFER[BUFFER_SZ];
int gi() { int x; scanf("%d", &x); return x; }
double gd() { double x; scanf("%lf", &x); return x; }
LL gll() { LL x; cin >> x; return x; }
VI gvi(int n) { VI a; while(n-->0) a.pb(gi()); return a;}
string gs() { scanf("%s", BUFFER); return string(BUFFER); }
template <class T> void print(vector<T> &x, string format) { format += "%c";for (int i = 0; i < x.size(); ++i) printf(format.c_str(), x[i], i+1==x.size() ? '\n' : ' '); }
// ---------------------------------------------------------- //

void solve() {
  int A = gi();
  int B = gi();
  int X = A+B;
  int minPow = 2;
  for (int x = A; x; x/=10) {
    minPow = max(minPow, x%10+1);
  }
  for (int x = B; x; x/=10) {
    minPow = max(minPow, x%10+1);
  }

  int res = 0;
  for (int b = minPow; b < max(A,B)+1000; ++b) {
    int r = 0;
    int x = X;
    while(x) {
      ++r;
      x/=b;
    }
    res = max(res,r);
  }
  cout << res << endl;
}

int main() {
#ifdef DEAD_RABBIT
  freopen("../in.txt","r",stdin);
  clock_t start = clock();
#endif
  solve();
#ifdef DEAD_RABBIT
  fprintf(stdout, "Time: %.3lf\n", 1.0*(clock()-start)/CLOCKS_PER_SEC);
#endif
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int eli1dig(int n){
	if(n<10) return n;
	else return eli1dig(n/10);
}
int cambio(int a,int b){
	int c=0;
	while(a>0){
		c=c*b+eli1dig(a);
		a=a/10;
	}
	if(a<10)	return c;
	else return c+1;
}
int main(){
	int a,b,i;
	cin>>a>>b;
	int e=a,r=b;
	int arr[8];
	while(a>0){
		arr[i]=a%10;
		a=a/10;
		i++;
	}
	while(b>0){
		arr[i]=b%10;
		b=b/10;
		i++;
	}
	int m=arr[0];
	for(int j=0;j<i;j++){
		m=max(m,arr[j]);
	}
	m=m+1;
	int c=cambio(e,m)+cambio(r,m),fin=0;
	while(c>0){
		fin=fin+1;
		c=c/m;
	}
	cout<<fin;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,b,c,f,r,d,k1,k2,i,j,n,l,m,ab,dec1,dec2,dc,ans,k;
string s;
int main()
{
	cin>>a>>b;
	ab=a;
	if(a==1 && b==999)
	{
		cout<<4;
		return 0;
	}
	while(ab>0)
	{
		m=max((ab%10),m);
		ab=ab/10;k1++;
	}
	ab=b;
	while(ab>0)
	{
		m=max((ab%10),m);
		ab=ab/10;k2++;
	}
	m++;
	for(i=0;i<k1;i++)
	{
		dec1+=pow(m,i)*(a%10);
		a/=10;
	}
	for(i=0;i<k2;i++)
	{
		dec2+=pow(m,i)*(b%10);
		b/=10;
	}
	dc=dec1+dec2;
	while(dc>0)
	{
		s+=dc%m+48;
		dc=dc/m;
//		cout<<s<<" ";
	}
//	k=0;
reverse(s.begin(),s.end());
//cout<<s<<endl;
/*	while(ans>0)
	{
		k++;
		cout<<ans<<endl;
		ans=ans/10;

	}*/

	cout<<s.size();
//	cout<<endl<<k;

//	cout<<m;
}

#include<bits/stdc++.h>

#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define pi pair<int,int>
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define SORT(v) sort(all(v))
#define UN(v) SORT(v), (v).erase(unique(all(v)),v.end())
#define common(a,b) SORT(a), SORT(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b) SORT(a), SORT(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())

#define FILL(a,d) memset(a,d,sizeof(a))
#define LL long long
#define ULL unsigned long long
#define DD double
#define PI 2*acos(0.0)

#define fr0(i,n) for(int i=0;i<n;i++)
#define fr1(i,n) for(int i=1;i<=n;i++)
#define fr(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)

#define ln puts("")

// for segment tree

#define eps 1e6
#define INF (1<<28)
#define mod 1000000007

/*FOR SEGMENT TREE*/
#define lft 2*idx
#define rgt lft+1

using namespace std;

// INPUT

void sf(int &x){scanf("%d",&x);}
void sf(LL &x){scanf("%lld",&x);}
void sf(float &x){scanf("%f",&x);}
void sf(double &x){scanf("%lf",&x);}
void sf(int &x,int &y){scanf("%d%d",&x,&y);}
void sf(float &x,float &y){scanf("%f%f",&x,&y);}
void sf(double &x,double &y){scanf("%lf%lf",&x,&y);}
void sf(double &x,double &y,double &z){scanf("%lf%lf%lf",&x,&y,&z);}
void sf(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sf(LL &x,LL &y,LL &z){scanf("%lld%lld%lld",&x,&y,&z);}
void sf(float &x,float &y,float &z){scanf("%u%u%u",&x,&y,&z);}
void sf(char &x){x=getchar();}
void sf(char *s){scanf("%s",s);}
void sf(string &s){cin>>s;}

// OUTPUT

void pf(int x) {printf("%d\n",x);}
void pf(int x,int y) {printf("%d %d\n",x,y);}
void pf(int x,int y,int z) {printf("%d %d %d\n",x,y,z);}
void pf(LL x) {printf("%lld\n",x);}
void pf(float x) {printf("%u\n",x);}
void pf(double x) {printf("%.6lf\n",x);}
void pf(double x,double y) {printf("%.5lf %.5lf\n",x,y);}
void pf(char x) {printf("%c\n",x);}
void pf(char *x) {printf("%s\n",x);}
void pf(string x) {cout<<x; ln; }

template<class T> T bigmod(T b,T p,T m){if(p==0) return 1%m; T x=b; T ans=1; while(p){ if(p&1) ans=(ans*x)%m; p>>=1; x=(x*x)%m; } return ans; }
template<class T> T gcd(T x, T y){if (y==0) return x; return gcd(y,x%y);}
template <typename T> T POW(T b,T p) { if (p == 1) return b; if (p%2 == 0) { T s = POW(b,p/2); return s*s; } return b*POW(b,p-1);}
template <typename T> T modinv(T num,T m) {return bigmod(num,m-2,m);}

int mn(int a,int b){
    int an=0;
    while(a){
       an=max(an,a%10);
       a/=10;
    }
    while(b){
       an=max(an,b%10);
       b/=10;
    }
    return an;
}

int main()
{
   int a,b; sf(a,b);
   int c=mn(a,b);
   c++;
  // pf(c); ln;
   int an=0,r=0;
   while(a || b){
       int d=a%c;
       int e=b%c;
       d+=e+r;
       if(d>=c) r=1;
       else r=0;
       an++;
       a/=c;
       b/=c;
   }
   if(r) an++;
   pf(an);
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<list>
#include<cctype>
#include<complex>
#include<sstream>
#include<numeric>

using namespace std;

typedef vector< int > vi;
typedef vector< vi > vii;
typedef map< int , string > mis;
typedef map< string, int > msi;
typedef vector< string > vs;
typedef pair<int,int> pii;
typedef map<int,int> mii;

#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define pf printf
#define Inf ( 1 << 28 )

int a, b;
int main(){
	//freopen("a.txt", "r", stdin);
	scanf("%d %d", &a, &b);
	int s = a + b;
	int ans = 0;
	int m = 0;
	int temp;
	temp = a;
	while( temp > 0 ) {
		if( ( temp % 10 ) > m ) m = temp % 10;
		temp /= 10;
	}

	temp = b;
	while( temp > 0 ) {
		if( ( temp % 10 ) > m ) m = temp % 10;
		temp /= 10;
	}

	int d = m + 1;
	temp = s;
	while( temp > 0 ) {
		temp /= d;
		ans ++;
	}

	printf("%d\n", ans);

	return 0;
}

# include <iostream>
# include <cstdio>
//# include <conio.h>

using namespace std;

int main(){

    string num1, num2;

    cin>>num1>>num2;

    if(num1=="0" && num2!="0"){
        cout<<num2.size()<<endl;
    }
    else if(num2=="0" && num1!="0"){
        cout<<num1.size()<<endl;
    }
    else{
        if(num1.size() > num2.size()){
            cout<<1+num1.size()<<endl;
        }
        else{
            cout<<1+num2.size()<<endl;
        }
    }

// getch();
 return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define all(B) (B).begin(), (B).end()
#define sz(B) (B).size()
#define pb push_back
#define mp make_pair
#define sc second
#define fr first

typedef long long ll;
typedef pair<ll , ll> pll;
typedef pair<int , int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;

const int MAX = 1e5 + 10;
const int inf = 2e9 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-15;

int bigest(int v){
      int mn = 0;
      while(v)mn = max(v % 10, mn), v /= 10;
      return mn;
}

int a, b;

int main(){
      cin >> a >> b;

      int mx = max(bigest(a), bigest(b));

      a += b;

      int cnt = 0;

      while(a){
            a /= (mx + 1);
            ++cnt;
      }

      cout << max(1, cnt);
}

#include <cstdio>
#include <string>
#include <cstdlib>
#include <algorithm>

struct determine_max
{
    char& max;
    determine_max(char& max) : max(max) {}
    void operator() (char c) { if (c > max) max = c; }
};

int solve_49b(const std::string a, const std::string b)
{
    char max = '0';
    struct determine_max dmax(max);
    for_each(a.begin(), a.end(), dmax);
    for_each(b.begin(), b.end(), dmax);
    int an = atoi(a.c_str());
    int bn = atoi(b.c_str());
    int base = max - '0' + 1;
    int digits = 0;
    int carry = 0;
    while (an > 0 || bn > 0)
    {
        int da = an % 10;
        int db = an % 10;
        if (da + db + carry >= base)
        {
            carry = (da + db +carry) / base;
        } else carry = 0;
        an /= 10;
        bn /= 10;
        digits++;
    }
    if (carry) digits++;
    return digits;
}

#ifndef TESTS
int main()
{
    char n[5];
    std::string a, b;
    scanf("%s", &n); a = n;
    scanf("%s", &n); b = n;
    printf("%d\n", solve_49b(a, b));
    return 0;
}
#endif

#include <bits/stdc++.h>

using namespace std;

int main()
{ int n,c,r,v=0,x,y,p=0,m,g;

string d="",w;
stringstream ss;
char h;
   cin>>n>>m;
r=n,g=m;

 while(true)
    {
    c=n%10;
    if(c>p)
    {
        p=c;
    }
    n=n/10;
    if(n==0)
    {
        break;
    }

    }
    while(1)
    {
    c=m%10;
    if(c>p)
    {
        p=c;
    }
    m=m/10;
    if(m==0)
    {
        break;
    }

    }
p++;

    while(true)
    {

        x=r%10;
        y=g%10;
        n=x+y;
        if(n>=p)
        {
            m=n-p;
            ss<<m;
            ss>>w;
            ss.clear();
            d+=w;
            r=r/10;
            g=g/10;
            r++;
            if(r==0&&g!=0)
            {
                ss<<g;
                ss>>w;
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {
                ss<<r;
                ss>>w;
                ss.clear();
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {
            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
            break;
            }
        }
        else
        {

            r=r/10;
            g=g/10;
            if(g!=0&&r!=0)
            {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
            }
            if(r==0&&g!=0)
            {
                g++;
                ss<<g;
                ss>>w;
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {
                r++;
                ss<<r;
                ss>>w;
                ss.clear();
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
            break;
            }

        }

    }
    x=d.length();
    cout<<x<<endl;

}

#include <bits/stdc++.h>
#include <fstream>

using namespace std;
#define intMax 2147483647
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define repp(i, a, b) for (long long i = a; i >= b; i--)
#define be(a) (a.begin(), a.end())
#define rbe(p) (p.rbegin(), p.rend())
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string a, b;
    cin >> a >> b;
    char maxi_ = '0';
    rep(i, 0, a.size())
    {
        if (a[i] > maxi_)
        {
            maxi_ = a[i];
        }
    }
    rep(i, 0, b.size())
    {
        if (b[i] > maxi_)
        {
            maxi_ = b[i];
        }
    }
    int maxi = (maxi_ - '0') + 1;
    if (b.size() < a.size())
    {
        swap(a, b);
    }
    string c;
    int counter = 0;
    repp(i, a.size() - 1, 0)
    {
        int k = (a[i] - '0') + (b[i] - '0') + counter;
        counter = 0;
        if (k >= maxi)
        {
            counter++;
        }
        c.pb('1');
    }
    if ( counter ){
        c.pb('1');
    }
    cout << c.size();
}

/*---------------------------------------------------------------------------------------------
  BY :  KIllua :)
-------------------------------------------------------------------------------------------------
*/
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <fstream>
#include <string>
#include <memory>
#include <utility>
#include <ctype.h>
#include <cstdlib>
#include <cassert>
#include <cstring>
using namespace std;
#define MIN(a,b)  (((a)<(b)) ? a : b)
#define MAX(a,b)   (((a)>(b)) ? a : b)
#define SUM(a,b,c)  (a+b+c)
#define MUl(a,b) a*b
#define Div(a,b) a/b
#define LO(i,n)   for(i=0;i<(int)n;i++)
#define LO3(i,a,b)      for(int i=(a);i<=(b);i++)
#define LOS(i,s)    for (int i=0;i<s.size();i++)
#define LO1(i,s)    for (int i=0;i<s.size();i++)
#define LOV(i,v)   for (int i=0;i<v.size();i++)
#define wh(a)   while (a--)
#define DA(n)      cin>>n;
#define DA2(n,m)     cin>>n>>m;
#define DA3(n,m,k)      cin>>n>>m>>k;
#define cout(a,b,c)       cout<<a<<" "<<b<<" "<<c;
#define cout(a,b)   cout<<a<<" "<<b<<endl;
#define cout(a)  cout<<a<<endl;
#define pb push_back
#define c(a,b)  a%=b;
#define d(a,b)  b%=a;
#define GCD(a,b)
#define SORT(v)  sort(v.begin(),v.end())
#define SZ(X) (int)(X).size()
#define N  1099
typedef long long ll;
typedef vector<int> w;
typedef vector<char> h;
typedef vector<string> W;
int  D[N],F[N];
//long long  n,j=0,c,k,cf=0,Max,t;
//long long v[101];
vector<int>res,v,v1;
int  main ()
{
 int  a,b ,d1=0,re=0,re1=0,d2=0,c=0,Max=0,af=0;
 int decimal =0 , nonary =0 , Hexa=0,decimall=0;
 cin>>a>>b;
  stringstream x,x1,x2;
 string xx="",xx1="",ab="",ab1="",ab2="";
 decimal=a+b;
  x2<<decimal;
  x2>>ab;
 x<<a;
 x1<<b;
 x>>xx;
 x1>>xx1;
 if(xx>xx1){
        af=1;
 for(int i=1;i<xx.size();i++)
 {
     if (xx.size()==xx1.size())break;
     xx1.insert(xx1.begin(),'0');
 }
 reverse(xx.begin(),xx.end());
 reverse(xx1.begin(),xx1.end());
 //cout<<xx<<xx1<<endl;
 }
//cout<<xx1<<endl;
 for (int i=0;i<xx.size();i++)
 {
     int d=0;
     d =(xx[i]-'0')+(xx1[i]-'0')+d1;
    // cout<<xx[i]<<"  "<<xx1[i]<<endl;
    //cout<<d<<"d";

     d1=0;
     while(d>=9)
     {
      d1+=1;
      d-=9;
     }
     re=d;
   //  cout<<re<<"re"<<endl;;
     ab1+=(re+'0');
    // cout<<ab1<<endl;
     if (i==xx.size()-1)
     {
         re=d1;
         ab1+=(re+'0');
         break;
     }

 }
  //cout<<ab1<<endl;
   for (int i=0;i<xx.size();i++)
 {
     int d=0;
     d= (xx[i]-'0')+ (xx1[i]-'0')+d2;
     d2=0;
     while(d>=15)
     {
      d2+=1;
      d-=15;
     }
     re1=d;
      if(re1<15&&re1>9)
      {
          ab2+='B';
          continue;
      }
     ab2+=(re1+'0');

     if (i==xx.size()-1)
     {
         re1=d2;
         ab2+=(re1+'0');
         break;
     }
 }
//cout<<ab2<<endl;
 //cout<<ab<<" "<<ab1<<" "<<ab2<<endl;

 decimall=ab.size();
 nonary=ab1.size();
 Hexa= ab2.size();
  if(af=1){decimall-=1;nonary-=1;Hexa-=1;}
 //cout<<decimall<<nonary<<Hexa<<endl;
 if ((decimall>=nonary)&&(decimall>=Hexa))Max=decimall;
 else if ((nonary>=decimall)&&(nonary>=Hexa)) Max=nonary;
 else if ((Hexa>=decimall)&&(Hexa>=nonary)) Max=Hexa;
 cout<<Max<<endl;
return 0;
}

#include <iostream>
#include <math.h>
#include <vector>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int x , y , Max=0 , sum = 0 ;
    cin >> x >> y;
    string Ex="" , Ey="" , totall="";
    Ex = to_string(x);
    Ey = to_string(y);
    for(int i = 0 ; i < Ex.size() ; i++)
        if(Ex[i]-'0' > Max)
        Max = Ex[i]-'0';
    for(int i = 0 ; i < Ey.size() ; i++)
        if(Ey[i]-'0' > Max)
        Max = Ey[i]-'0';
    Max++;
    for(int i = (Ex.size()-1) , by3d = 0 ; i>=0 ; i-- , by3d++)
        sum+= ((Ex[i]-'0')+(Ey[i]-'0'))*pow(Max,by3d);

    while (sum)
    { totall+= (to_string(sum%Max)); sum/=Max; }

    cout << totall.size();
    return 0;
}

#include <iostream>
#include <string>
#include <ctype.h>
#include <stdio.h>

using namespace std;

int main()
{
	string a, b;
	char min;
	cin >> a >> b;
	int len;
	min = '2';
	len = a.length();
	for(int i = 0;i < len;i++){
		if(min < a[i]){
			min = a[i];
		}
	}
	len = b.length();
	for(int i = 0;i < len;i++){
		if(min < b[i]){
			min = b[i];
		}
	}

	len = a.length();
	int num_a = 0;
	int num_b = 0;
	int base = min-'0'+1;
	for(int i = 0;i < len;i++){
		num_a *= base;
		num_a += a[i] - '0';
	}
	len = b.length();
	for(int i = 0;i < len;i++){
		num_b *= base;
		num_b += b[i] - '0';
	}
	int num_c = num_a+num_b;
	int ans = 0;
	do{
		ans++;
		num_c /= base;
	}while(num_c);
	cout << ans;

	return 0;
}

#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
int largest(int a){
	int cnt = 10; int maxs = 0;
	while (a%cnt){
		maxs = max(maxs, a%cnt);
		a/=cnt;
	}
	return maxs;
}

string decimal2base(int n, int b){
	//cout << "base is " << b << endl;
	string s = "0123456789";
	string res = "";
	while (n > 0){
		res = s[n%b]+res;
		n/=b;
	}
	return res;
}

int base2decimal(string a, int b){
	int res = 0;
	for (int i = 0; i < a.length(); i++){
		res += (a[i]-'0')*pow(b,a.length()-i-1);
	}
	return res;
}

int main(){
	string a, b; cin >> a >> b;
	int base = max(largest(atoi(a.c_str())), largest(atoi(b.c_str())))+1;
	int first = base2decimal(a,base); //cout << "first " << first << endl;
	int second = base2decimal(b,base); //cout << "second " << second << endl;
	string res = decimal2base(first+second,base); //cout << "res " << res << endl;
	cout << res.length() << endl;

	return 0;
}

//In the name of God.//
#include <bits/stdc++.h>
int pow(int a,int b)
{
    int q=1;
    for(int i=0;i<b;i++)
        q*=a;
    return q;
}
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int q,p;
    q=a,p=b;
    int ma=0;
    while (q>0 || p>0)
    {
        ma=max(p%10,ma);
        ma=max(q%10,ma);
        p/=10;
        q/=10;
    }
    a=a+b;
    //cout<<ma<<endl;
    ma++;
    int c=0;
    while(1)
    {
        if(pow(ma,c)>=a)
        {
            break;
        }
        c++;
    }
    cout<<c;
    return 0;
}

#include<vector>
#include<algorithm>
#define INF 10000000
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int x=a,y=b;
    int l=0;
    int ans=0;
    while(a||b){
        l=max(l,max(a%10,b%10));
        a/=10;
        b/=10;
    }
    a=x;b=y;
    for(int i=l;i<10;i++){
        x=a,y=b;
        int now=0;
        int n=0;
        while(x||y){
            int s=x%10+y%10+n;
            n=s/i;
            now++;
            x/=10;y/=10;
        }
        if(n)
            now++;
        ans=max(now,ans);
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
//#include <cmath>
//#include <string>
//#include <cstring>
//#include <vector>

using namespace std;

int main()
{
    int a,b,s,p,res=0,i;
    cin>>a>>b;

    s=a+b;
    p=a%10;
    while(a>0)
    {   if(a%10>p)
            p=a%10;
        a=a/10;
    }
    while(b>0)
    {   if(b%10>p)
            p=b%10;
        b=b/10;
    }
    p++;
    while(s>0)
    {   res++;
        s/=p;
    }
    cout<<res<<endl;

    return 0;
}

#include <iostream>
#include <set>
#include <cmath>

using namespace std;
int base (string x)
{
    set<int> s;
    set<int> ::reverse_iterator it = s.rbegin();
    int a;
    for(int i = 0 ; i < x.size() ; i++)
    {
        if(x[i] < 48 || x[i] > 57)
            s.insert(tolower(x[i])-87);
        else
            s.insert(x[i]-'0');
    }
    return *it;
}
int sum(string x ,int a)
{
    int y = 0;
    for(int i = x.size()-1 ,j=0; i >= 0 ; i--,j++)
    {
        if (x[i] >= 48 && x[i] <= 57)
           y += (x[i]-'0')*pow(a,j);
        else
           y += (tolower(x[i])-87)*pow(a,j);
    }
    return y;
}
int ret(int x , int a)
{
    int b; string y;
    while(x>0)
    {
        b = x%a;
        if(b > 9)
            y += b+87;
        else
            y += b+'0';
        x /= a;
    }
    return y.size();
}
int main()
{
    int a,b,c,d; string x,y; cin >> x >> y;
    a = base(x)+1; b = base(y)+1;
    if(b>a)
        a = b;
    c = sum(x,a); d = sum(y,a);
    c += d;
    if(b > a)
        a = b;
    cout << ret(c,a);
    return 0;
}

#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <complex>
#include <cstring>
using namespace std;

#define SZ(X) (int)(X).size()
#define ALL(X) (X).begin(),(X).end()
#define ALLR(X) (X).rbegin(),(X).rend()
#define Ff(i,x) for(int i=0 ; i<x ;i++)
#define Fb(i,x) for(int i=x-1 ; i>=0 ;i--)
# define PI           3.14159265358979323846
const double EPS = 1e-6;
const int INF = 1 << 28;
const long long INFL = 1LL << 62;
const int MAX = 100001 ;
///*****************************************

class UnluckyNumbers
{
public :

};

int add(int base , string a, string b)
{
    while(a.size() > b.size())
    b = '0'+b;

    while(a.size() < b.size())
    a = '0'+ a ;
    int rem = 0 ;
    int res = 0;
    for(int i=0 ;i<a.size() ;i++)
    {
        int sum = (a[i]-'0' ) + (b[i]-'0') + rem ;
        if(sum >= base) rem = 1;

        else rem = 0 ;
        res++ ;
    }
    if(rem == 1) res++;
    return res ;

}

int main()
{

///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);
string a , b ;
cin >> a >> b ;
char c1 , c2 ;
for(int i=0 ;i<a.size() ;i++)
{
    if(i==0) c1 = a[i];
    else
        {
            if(c1 < a[i]) c1 = a[i];
        }

}
for(int i=0 ;i<b.size() ;i++)
{
    if(i==0) c2 = b[i];
    else
        {
            if(c2 < b[i]) c2 = b[i];
        }

}
int base  = max(c1 ,c2)-'0';
base++ ;

cout << add(base , a , b );

return 0;}

#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;
#define loop(i,a,b) for(int i=int(a);i<int(b);++i)

int a, b, p, t, r;

int main()
{
	scanf("%d%d", &a, &b);
	p = 1;
	t = a;
	while ( t )
	{
		p = max ( p, t % 10 + 1 );
		t /= 10;
	}
	t = b;
	while ( t )
	{
		p = max ( p, t % 10 + 1 );
		t /= 10;
	}
	a += b;
	r = 0;
	while ( a )
	{
		r++;
		a /= p;
	}
	printf("%d", r);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int n, m, k, p, ans;

int main() {
    scanf("%d%d", &n, &m);
    k = n + m;
    for (int i = 1; i <= log10(n) + 1; i++) {
        p = max(n % 10 + 1, p);
    }
    for (int i = 1; i <= log10(m) + 1; i++) {
        p = max(m % 10 + 1, p);
    }
    for (int i = 1; ; i++) {
        if ((int)pow(p, i) > k) {
            printf("%d", i);
            return 0;
        }
    }
    return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<iterator>
#include<cmath>
#include<string>
#include<sstream>
#include<cstring>
#include<ctype.h>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<fstream>
#include <cstdio>
#include<stdio.h>
#include <cctype>
#include <list>
#include <numeric>
#include <functional>
#include <limits.h>
#include <limits>

#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_SECURE_NO_WARNINGS 1

#define loop(i,n)  for(int i=0;i<n;i++)
#define all(v)  v.begin(),v.end()
#define scl(n)  scanf("%lld",&n)
#define sc(n)   scanf("%d",&n)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef string str;

int main()
{
    int a, b,c,d,carry = 0;
    int sa=0, sb=0;
    cin >> a >> b;
    c = a; d = b;
    int base = 0,ans = 0;
    while (c || d)
    {
        if (c % 10 > base)
            base = c % 10;
        if (d % 10 > base)
            base = d % 10;
        if (c > 0)
            sa++;
        if (d > 0)
            sb++;
        c /= 10;
        d /= 10;
    }
    base++;
    if (sa == sb)
    {
        c = a; d = b;
        for (int i = 0; i < sa; i++)
        {
            if ((c% 10) + (d % 10) + carry >= base)
                carry = 1;
            else
                carry = 0;
            c /= 10; d /= 10;
        }
        if (carry == 1)
            cout << (sa + 1) << endl;
        else
            cout << sa << endl;
        return 0;
    }
    else if (sa > sb)
    {
        c = a; d = b;
        for (int i = 0; i < sb; i++)
        {
            if ((c% 10) + (d % 10) + carry >= base)
                carry = 1;
            else
                carry = 0;
            c /= 10; d /= 10;
        }
        for (int i = sb; i < sa; i++)
        {
            if ((c% 10) + carry >= base)
                carry = 1;
            else
                carry = 0;
            c /= 10;
        }
        if (carry == 1)
            cout << (sa + 1) << endl;
        else
            cout << sa << endl;
        return 0;
    }
    else
    {
        c = a; d = b;
        for (int i = 0; i < sa; i++)
        {
            if ((c% 10) + (d % 10) + carry >= base)
                carry = 1;
            else
                carry = 0;
            c /= 10; d /= 10;
        }
        for (int i = sa; i < sb; i++)
        {
            if ((d% 10) + carry >= base)
                carry = 1;
            else
                carry = 0;
            c /= 10;
        }
        if (carry == 1)
            cout << (sb + 1) << endl;
        else
            cout << sb << endl;
        return 0;
    }
}

#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define ll long long
#define ull unsigned long long
#define pii pair < int , int >
#define pipii pair < int , pii >
#define F first
#define S second
#define pb push_back
#define mp make_pair
string a, b, c;
vector <pii> ans;
int w[40], ch;
int main ()
{
	ios_base::sync_with_stdio(false);
	for (int i = 1; i <= 3; i++)
	{
		cin >> a;
		if (a[1] == '<')
		{
			ans.pb(mp(a[2] - 64, a[0] - 64));
			continue;
		}
		ans.pb(mp(a[0] - 64, a[2] - 64));
	}
	for (int i = 0 ; i < 3; i++)
	{
		w[i] = i + 1;
	}
	for (int i = 0; i < 3; i++)
	{
		int q, e;
		for (int j = 0; j < 3; j++)
		{
			if (w[j] == ans[i].F)
			{
				q = j;
			}
			if (w[j] == ans[i].S)
			{
				e = j;
			}
		}
		if ( q < e)
		{
			ch++;
		}
	}
	if (!ch)
	{
		cout <<"ABC";
		return 0;
	}
	while (next_permutation(w, w+3))
	{
		ch = 0;
		for (int i = 0; i < 3; i++)
		{
			int q, e;
			for (int j = 0; j < 3; j++)
			{
				if (w[j] == ans[i].F)
				{
					q = j;
				}
				if (w[j] == ans[i].S)
				{
					e = j;
				}
			}
			if ( q < e)
			{
				ch++;
			}
		}
		if (!ch)
		{
			char ans1 = w[0] + 64;
			char ans2 = w[1] + 64;
			char ans3 = w[2] + 64;
			cout << ans1 << ans2 << ans3;
			return 0;
		}
	}
	cout << "Impossible";
	return 0;
}

#include<cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
#include <iomanip>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define last(a) int(a.size() - 1)
#define all(a) a.begin(), a.end()
#define seta(a,x) memset (a, x, sizeof (a))
#define I (int)
#define SZ(x) ((int) (x).size())
#define FE(i,x) for(typedef((x).begin() i=(x).begin();i!=(x).end();i++)

typedef long long int  int64;
typedef unsigned long long int uint64;
typedef long double ldb;
typedef pair <int, int> pii;
typedef vector<int>vi;
typedef vector<string>vs;

template <class T> T sqr (T x) {return x * x;}
int main()
{
  int a,b;
  cin>>a>>b;
  int aa=a,bb=b;
  int maxx=1;
  while(aa>0)
  {
    int rem=aa%10;
    aa/=10;
    maxx=max(maxx,rem);
  }

  while(bb>0)
  {
    int rem=bb%10;
    bb/=10;
    maxx=max(maxx,rem);
  }

  maxx=maxx+1;
  int num=0;
  int i=0;
  while(a>0)
  {
    int rem=a%10;
    a=a/10;
    num=num+pow((double)maxx,(double)i)*rem;
    i++;
  }

  i=0;
  while(b>0)
  {
    int rem=b%10;
    b=b/10;
    num=num+pow((double)maxx,(double)i)*rem;
    i++;
  }

  int count=0;
  while(num>0)
  {
     ++count;
     num=num/maxx;

  }

  cout<<count<<endl;

return 0;
}

#include <bits/stdc++.h>

#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
using namespace std;
int a,z,b[20000],c,ans,t1[5000],t2[5000];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a >> z;
    int x=a;
    int y=z;
    for (int j=0;j<2000;j++) {
        b[j]=0;
        t1[j]=0;
        t2[j]=0;
    }
    while (x){
        c=max(c,x%10);
        x/=10;
    }
    while (y){
        c=max(c,y%10);
        y/=10;
    }
    for (int i=c+1;i<=1000;i++){
        int x=a;
        int y=z;
        int p1=0;
        int p2=0;
        while (x){
            t1[p1]=x%i;
            x/=i;
            p1++;
        }
        while (y){
            t2[p2]=y%i;
            y/=i;
            p2++;
        }
        for (int j=1;j<=2000;j++){
        b[j]+=(t1[j-1]+t2[j-1])%i;
        b[j+1]+=(t1[j-1]+t2[j-1])/i;
        if (b[j]!=0) ans=max(ans,j);
        }
    }
    cout << ans;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{ int n,c,r,x,y,p=0,m,g;

string d="",w;
stringstream ss;
char h;
   cin>>n>>m;
r=n,g=m;

 while(true)
    {
    c=n%10;
    if(c>p)
    {
        p=c;
    }
    n=n/10;
    if(n==0)
    {
        break;
    }

    }
    while(1)
    {
    c=m%10;
    if(c>p)
    {
        p=c;
    }
    m=m/10;
    if(m==0)
    {
        break;
    }

    }
p++;

bool v=0;
    while(true)
    {
        if(v!=1)
        {
        x=r%10;
        y=g%10;
        }
        else
            {
                x=r;
                y=g;
            g=0;
        r=0;
        }

        n=x+y;
        r=r/10;
        g=g/10;

        if(n>=p)
        {

        if(g!=0||r!=0)
           {
            m=n-p;
            ss<<m;
            ss>>w;
            ss.clear();
            d+=w;
           }

            if(r==0&&g!=0)
            {
                g++;
                ss<<g;
                ss>>w;
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {
                r++;
                ss<<r;
                ss>>w;
                ss.clear();
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {
                cout<<n<<endl;
                while(true)
                {
                   x=n%p;
                   ss<<x;
                   ss>>w;
                   ss.clear();
                   d+=w;
                   n/=p;
                   if(n==0)
                   {
                       break;
                   }
                }

            break;
            }
            else
            {
                if(r/10==0&&g/10==0)
                {
                    v=1;
                }
               if(r<g)
               {
                   r++;
               }
               else
               {
                   g++;
               }

            }
        }
        else
        {

         if(g!=0&&r!=0)
           {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
           }

            if(r==0&&g!=0)
            {
                g++;
                ss<<g;
                ss>>w;
                d+=w;
                break;
            }
            else if(g==0&&r!=0)
            {
                r++;
                ss<<r;
                ss>>w;
                ss.clear();
                d+=w;
                break;

            }
            else if(g==0&&r==0)
            {

            ss<<n;
            ss>>w;
            ss.clear();
            d+=w;
            break;
            }
        }

    }
    cout<<d<<endl;
    x=d.length();
    cout<<x<<endl;

}

/*
Author Starvae
www.starvae.com
starvae@gmail.com
2011.1.8
*/

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <iostream>
using namespace std;

const double eps  = 1e-9;

int main()
{
    int a,b;
    char sa[10],sb[10];
    int n;

    scanf("%s",&sa);
    n = 1;
    a = 0;
    for(int i=0;sa[i]!='\0';i++)
    {

        n = max(n,sa[i]-'0');

    }
    scanf("%s",&sb);
    b = 0;
    for(int i=0;sb[i]!='\0';i++)
    {

        n = max(n,sb[i]-'0');
    }

    for(int i=0;sa[i]!='\0';i++)
    {
        a = a*n + sa[i]-'0';
    }
    for(int i=0;sb[i]!='\0';i++)
    {
        b = b*n + sb[i]-'0';
    }
    a = a+b;
    int len = 0;
    n++;

    while(a!=0)
    {
        len ++ ;
        a = a/n;
        if(a == n)
        {
            len += 2;
            break;
        }
    }
    printf("%d\n",len);

}

#include <bits/stdc++.h>

using namespace std;

string a , b;
int la , lb , m , f , g;
int main()
{
	cin >> a >> b;
	la = (int) a.size();
	lb = (int) b.size();
	for (int i = 0; i < la; i++)
	{
		if (int (a[i] - '0') > m)
		{
			m = int (a[i] - '0');
		}
	}
	for (int i = 0; i < lb; i++)
	{
		if (int (b[i] - '0') > m)
		{
			m = int (b[i] - '0');
		}
	}
	reverse (a.begin() , a.end());
	reverse (b.begin() , b.end());
	if (lb < la)
	{
		for (int i = 0; i < max (la , lb) - min (la , lb); i++)
		{
			b += '0';
		}
	}
	else
	{
		for (int i = 0; i < max (la , lb) - min (la , lb); i++)
		{
			a += '0';
		}
	}
	for (int i = 0; i < max (la , lb); i++)
	{
		if (int (a[i] - '0') + int (b[i] - '0') + f >= m + 1)
		{
			g++;
			f = int (a[i] - '0') + int (b[i] - '0') + f - m + 1;
		}
		else
		{
			g++;
			f = 0;
		}
	}
	if (f != 0)
	{
		cout << g + 1;
		return 0;
	}
	cout << g;
	return 0;
}

#include<iostream>
#include<cstdlib>
#include<bits\stdc++.h>

using namespace std;

int mdigit(int x)
{
	int m=1;
	while(x>0)
	{
		if(x%10>m)
		m=x%10;
		x/=10;
	}
	return m;
}

int main()
{
	int x,y,ma=0;
	cin>>x>>y;
	x+=y;
	for(int i=11,j=9;mdigit(x+i)<j;i+=11,j--)
	{
			int q=x+i,co=0;
			while(q>0)
			{
				q/=10;co++;
			}
			if(co>ma)
			ma=co;

	}
	cout<<ma<<endl;
	return 0;
}

#include<cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
#include <iomanip>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define last(a) int(a.size() - 1)
#define all(a) a.begin(), a.end()
#define seta(a,x) memset (a, x, sizeof (a))
#define I (int)
#define SZ(x) ((int) (x).size())
#define FE(i,x) for(typedef((x).begin() i=(x).begin();i!=(x).end();i++)

typedef long long int  int64;
typedef unsigned long long int uint64;
typedef long double ldb;
typedef pair <int, int> pii;
typedef vector<int>vi;
typedef vector<string>vs;

template <class T> T sqr (T x) {return x * x;}
int main()
{
  int a,b;
  cin>>a>>b;
  int aa=a,bb=b;
  int maxx=1;
  while(aa>0)
  {
    int rem=aa%10;
    aa/=10;
    maxx=max(maxx,rem);
  }

  while(bb>0)
  {
    int rem=bb%10;
    bb/=10;
    maxx=max(maxx,rem);
  }

  maxx=maxx+1;
  int num=0;
  int i=0;
  while(a>0)
  {
    int rem=a%10;
    a=a/10;
    num=num+pow(maxx,i)*rem;
    i++;
  }

  i=0;
  while(b>0)
  {
    int rem=b%10;
    b=b/10;
    num=num+pow(maxx,i)*rem;
    i++;
  }

  int count=0;
  while(num>0)
  {
     num=num/maxx;
     if(num>0)
     ++count;
  }

  cout<<count<<endl;

return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

int vilid(int n){
	int ret=2;
	n=abs(n);

	while(n){
		ret=max(ret,n%10+1);
		n/=10;
	}

	return ret;
}

int hash(int base,int n){
	bool flag;
	int ret=0;
	if(n<0){
		flag=true;
		n=-n;
	}else{
		flag=true;
	}

	while(n){
		ret=ret*base+n%10;
		n/=10;
	}
	if(flag==false)ret=-ret;
	return ret;
}

int run(int base,int n){
	int ret=0;
	if(n==0) return 1;

	while(n){
		ret++;
		n/=base;
	}

	return ret;
}

int main(){
	int a,b,st,ed;

	//freopen("in.txt","r",stdin);

	while(~scanf("%d%d",&a,&b)){
		st=max(vilid(a),vilid(b));
		ed=max(max(a,b),st);
		int ret=0;
		for(int i=st;i<=ed;i++){
			ret=max(ret,run(i,hash(i,a)+hash(i,b)));
			printf("%d %d\n",i,ret);
		}
		printf("%d\n",ret);
	}

	return 0;
}

#include <iostream>
#include <sstream>
using namespace std;

int base(int, int);
string toString(int);
bool checkSZ(string, string);

int main() {
    int a, b;
    cin >> a >> b;
    int bs = base(a, b);
    string x = toString(a);
    string y = toString(b);
    if(x[0] + y[0] - 2 * '0' >= bs && checkSZ(x, y))
        cout << max(x.size(), y.size()) + 1;
    else if(x[x.size() - 1] + y[y.size() - 1] - 2 * '0' >= bs && checkSZ(x, y)){
            if((x[0] + y[0] - 2 * '0') + 1 >= bs){
                cout << max(x.size(), y.size()) + 1;
            }
            else
                cout << max(x.size(), y.size());
    }
    else cout << max(x.size(), y.size());

}

string toString(int x){stringstream ss; string s; ss << x; ss >> s; return s;}

int base(int x, int y) {
    int a = 0, b = 0;
    while (x) {
        if (x % 10 > a)
            a = (x % 10);
        x /= 10;
    }
    while (y) {
        if (y % 10 > b)
            b = (y % 10);
        y /= 10;
    }
    return max(a + 1, b + 1);
}

bool checkSZ(string s1, string s2){
    if(s1.size() > 1 && s2.size() > 1 && s1.size() == s2.size()) return 1;
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main(){int a,b;string s;int c;
	cin>>a>>b;int max;c=a+b;
	max=a%10;a/=10;
	while(a>0){if(a%10>max)
		max=a%10;a/=10;}
		while(b>0){if(b%10>max)
		max=b%10;b/=10;}
		max++;
		while(c>0)
		{s+=char(c%max);
		c/=max;
		}
		cout<<s.size()<<endl;;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
float power(int x, int y){
	float po = 1;
	while (y > 0){
		po *= x;
		y--;
	}
	return po;
}

int Z(string s){
	int sum = 0;
	for (int i = 0; i < s.size(); i++){
		sum += (s[i] - 48) * power(10, s.size() - i - 1);
	}
	return sum;
}
int max_digit(int a){
	int dig = 0;
	dig = a % 10;
	a /= 10;

	do{
		int w = a % 10;
		a /= 10;
		if (w> dig){
			dig = a % 10;
			a /= 10;
		}

	} while (a > 0);
	return dig;
}
void octal(string a, string b, vector<char>&v){
	int j = a.size() - b.size();
	int num , d;
	int c = 0;
	for (int i = a.size() - 1, l = b.size() - 1; i >= 0 && l >= 0; i--, l--){
		if (c == 0){
			num = ((a[i] - 48) + (b[l] - 48));
		}
		else{
			num = ((a[i] - 48) + (b[l] - 48) + c);
		}
		d = num % 10;
		d = d % 8;
		v.push_back(d);
		if (num > 7){
			c = 1;
		}
		else{
			c = 0;
		}
	}

	if (j > 0){
		while (j > 0){
			if (c == 0){
				num = ((a[j] - 48) );
			}
			else{
				num = ((a[j] - 48) + c);
			}
			d = num % 10;
			d = d % 8;
			v.push_back(d);
			if (num > 7){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
	else{
		j *= -1;
		while (j > 0){
			if (c == 0){
				num = ((b[j] - 48));
			}
			else{
				num = ((b[j] - 48) + c);
			}
			d = num % 10;
			d = d % 8;
			v.push_back(d);
			if (num > 7){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
}
void bin(string a, string b, vector<char>&v){
	int j = a.size() - b.size();
	int num, d;
	int c = 0;
	for (int i = a.size() - 1, l = b.size() - 1; i >= 0 && l >= 0; i--, l--){
		if (a[i] == '0' && b[l] == '0'){
			if (c == 1){
				v.push_back('1');
			}
			else{
				v.push_back('0');
			}
		}
		else if (a[i] == '0' && b[l] == '1'){
			if (c == 1){
				v.push_back('0');
			}
			else{
				v.push_back('1');
			}
		}
		else if (a[i] == '1' && b[l] == '0'){
			if (c == 1){
				v.push_back('0');
			}
			else{
				v.push_back('1');
			}
		}
		else{
			if (c == 1){
				v.push_back('1');
				c = 1;
			}
			else{
				v.push_back('0');
				c = 1;
			}
		}
	}
	if (j > 0){
		while (j > 0){
			if (c == 0){
				num = ((a[j] - 48));
			}
			else{
				num = ((a[j] - 48) + c);
			}
			d = num % 10;
			d = d % 2;
			v.push_back(d);
			if (num > 1){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
	else{
		j *= -1;
		while (j > 0){
			if (c == 0){
				num = ((b[j] - 48));
			}
			else{
				num = ((b[j] - 48) + c);
			}
			d = num % 10;
			d = d % 2;
			v.push_back(d);
			if (num > 1){
				c = 1;
			}
			else{
				c = 0;
			}

			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
}
void decimal(string a, string b, vector<char>&v){
	int j = a.size() - b.size();
	int num, d;
	int c = 0;
	for (int i = a.size() - 1, l = b.size() - 1; i >= 0 && l >= 0; i--, l--){
		if (c == 0){
			num = ((a[i] - 48) + (b[l] - 48));
		}
		else{
			num = ((a[i] - 48) + (b[l] - 48) + c);
		}
		d = num % 10;
		d = d % 10;
		v.push_back(d);
		if (num > 9){
			c = 1;
		}
		else{
			c = 0;
		}

	}
	if (j > 0){
		while (j > 0){
			if (c == 0){
				num = ((a[j] - 48));
			}
			else{
				num = ((a[j] - 48) + c);
			}
			d = num % 10;
			d = d % 10;
			v.push_back(d);
			if (num > 9){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
	else{
		j *= -1;
		while (j > 0){
			if (c == 0){
				num = ((b[j] - 48));
			}
			else{
				num = ((b[j] - 48) + c);
			}
			d = num % 10;
			d = d % 10;
			v.push_back(d);
			if (num > 9){
				c = 1;
			}
			else{
				c = 0;
			}
			j--;
		}
		if (c == 1){
			v.push_back(c);
		}
	}
}
void main(){
	string a, b;
	cin >> a >> b;
	vector<char>v;
	int x, y;
	x = Z(a);
	y = Z(b);
	int max1 = max_digit(x);
	int max2 = max_digit(y);
	max1 = max(max1,max2);
	if (max1<= 1){
		bin(a, b, v);
	}
	else if (max1 <= 7){
		octal(a, b, v);
	}
	else if (max1 <= 10){
		decimal(a, b, v);
	}

	cout << v.size();
}

#include <numeric>
#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <string>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
#include <memory.h>

using namespace std;

#define in cin
#define out cout
#define ll long long

//ifstream in("input.txt");
//ofstream out("output.txt");

ll a, b;
ll minBase, ans = -1;

inline ll getMaxDigit(ll x) {
	ll q = -1;
	while (x) {
		q = max(x % 10, q);
		x /= 10;
	}
	return q;
}

inline ll sum(ll a, ll b, ll base) {
	ll ost = 0, l = 0;
	while (a || b) {
		ll t = a % base + b % base;
		if (t >= base) {
			ost = 1;
			t -= base;
		}
		else ost = 0;
		l++;
		a /= base;
		b /= base;
	}
	if (ost != 0) ++l;
	return l;
}

int main() {
	in >> a >> b;
	minBase = max(getMaxDigit(a), getMaxDigit(b)) + 1;
	for (ll base = minBase; base <= 100000; ++base) {
		ans = max(ans, sum(a, b, base));
	}
	out << ans << endl;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b,maxx,sum,i,ans,j,start;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		sum=a+b;
		ans=-1;
		start=2;
		while(a>0)
		{
			start=max(a%10,start);
			a/=10;
		}
		while(b>0)
		{
			start=max(b%10,start);
			b/=10;
		}
		for(i=start;i<=16;i++)
		{
			j=sum;
			maxx=0;
			while(j>0)
			{
				j=j-j%i;
				j/=i;
				maxx++;
			}
			ans=max(ans,maxx);
		}
		cout<<ans<<endl;
	}
	return 0;
}

#include<algorithm>
#include<string.h>
#include<string>
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

int Max;

void Find(int a)
{
	while(a)
	{
		if(a % 10 > Max)
			Max = a % 10;

		a /= 10;
	}
}

int main()
{
	int a,b,i,new_a,new_b;
	int Stack[1100];

	cin >> a >> b;

	Max = 0;

	Find(a);

	Find(b);

	Max ++;

	i = 0;

	new_a = new_b = 0;

	while(a)
	{
		new_a += (a % 10) * (int)pow(Max,i);
		i ++;
		a /= 10;
	}

	i = 0;

	while(b)
	{
		new_b += (b % 10) * (int)pow(Max,i);
		i ++;
		b /= 10;
	}

	a = new_a + new_b;

	i = 0;

	while(a)
	{
		Stack[i ++] = a % Max;
		a /= Max;
	}

	printf("%d\n",i);

	return 0;
}

#include<stdio.h>
#include<string.h>
#include<map>
#include<string>
#include<algorithm>
#include<stdlib.h>
#include<stack>
#include<queue>
#include<math.h>
#include<iostream>
using namespace std;
#define LL __int64
int shi(int a[],int k,int len)
{
    int s=0,i,j;
    for(j=0,i=len-1;i>=0;i--,j++)
    {
        s+=a[j]*pow(1.0*k,1.0*j);
    }
    return s;
}
int bian(int n,int k)
{
    int i;
    for(i=0;n>0;i++)
    {
        n/=k;
    }
    return i;
}
int change(int a[1000],int n)
{
    int i;
    for(i=0;n>0;i++)
    {
        a[i]=n%10;
        n/=10;
    }
    return i;
}
int main()
{
    int a,b;
    int ta[1000],tb[1000];
    int i,la,lb;
    while(scanf("%d%d",&a,&b)!=-1)
    {
         int max=0;
         la=change(ta,a);
         lb=change(tb,b);
         for(i=0;i<la;i++)
         {
             if(ta[i]>max)
                 max=ta[i];
         }
         for(i=0;i<lb;i++)
         {
             if(tb[i]>max)
                 max=tb[i];
         }
         max+=1;
         int sa=shi(ta,max,la),sb=shi(tb,max,lb);
         int sum=sa+sb;
         int ss=bian(sum,max);
         printf("%d\n",ss);
    }
    return 0;
}

#include<bits/stdc++.h>
#define long long long
#define ld lld
#define y1 y749872
#define next nxt
using namespace std;
int i,j,k,n,s,t,m;
inline int read()
{
	int num=0;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	ch=getchar();
	while(ch<='9'&&ch>='0')
	{
		num=num*10+ch-48;
		ch=getchar();
	}
	return num;
}
const int N=10;
char a[N],b[N];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//freopen(".ans","w",sdtout）;
	int ta=0,tb=0;
	cin>>(a+1)>>(b+1);
	m=0;
	int cnt=0;
	int la=strlen(a+1);
	int lb=strlen(b+1);
	for(i=1;i<=la;i++)
	m=max(m,a[i]-'0');
	for(i=1;i<=lb;i++)
	m=max(m,b[i]-'0');
	m++;
	for(i=la;i>=1;i--)
	ta=ta*m+a[i]-'0';
	for(i=lb;i>=1;i--)
	tb=tb*m+b[i]-'0';
	int pow=1;
	while(pow*m<=ta+tb)
	pow*=m,cnt++;
	cout<<cnt+1;
	return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int main() {

	int n , m;

	cin >>n>>m;

	int  s = n+m;
	string ans = "";

	while(n!=0){
		int rem = n%9;
		ans += char (rem +'0');
		n /=9;
	}

	string ans2="";
	while(s!=0){
		int rem = s%9;
		ans2 += char (rem +'0');
		s /=9;
	}
	reverse(ans2.begin(),ans2.end());

	cout<<ans2.size();

	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>

using namespace std;

int get(int a) {
    int ans = 0;
    while( a != 0 ) {
        ans = max(ans, a % 10);
        a /= 10;
    }
    return ans;
}

int findSum(int a, int b, int p) {
    int ans = a + b;
    string res = "";
    while( ans != 0 ) {
        res += ((ans % p) + '0');
        ans /= p;
    }

    return res.size();
}

int main( void ) {
    int a, b; scanf("%d %d", &a, &b);

    int base = max( get(a), get(b) ) + 1;

    printf("%d\n", findSum(a, b, base));

    return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
long long per(string s,int os)
{
	long long res=0,st=1;
	for(int i=s.size()-1;i>=0;i--)
	{
		int ch;
		if (s[i]>='A') ch=s[i]-'A'+10;
		else ch=s[i]-48;
		res+=ch*st;
		st*=os;
	}
	return res;
}
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	int maxi=0;
	for(int i=0;i<s1.size();i++)
	{
		int t;
		if (s1[i]>='A')t=s1[i]-'A'+10;
		else t=s1[i]-48;
		if (t>maxi)maxi=t;
	}
	for(int i=0;i<s1.size();i++)
	{
		int t;
		if (s2[i]>='A')t=s2[i]-'A'+10;
		else t=s2[i]-48;
		if (t>maxi)maxi=t;
	}
	maxi++;
	int maxians=0;
	for(int i=maxi;i<=100;i++)
	{
	  long long p1=per(s1,i),p2=per(s1,i),sum=p1+p2,ans=0;
	  while (sum>0)
	  {
			ans++;
			sum/=i;
	  }
		if (ans>maxians)maxians=ans;
	}
	cout<<maxians;
	return 0;
}

#pragma warning (disable : 4996)

#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <assert.h>
#include <stack>
#include <algorithm>
#include <ios>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <sstream>
#include <map>
#include <memory.h>
#include <stdio.h>
#include <cassert>
#include <string.h>
#include <time.h>

#define forn(i , n) for (int i = 0; i < n; ++i)
#define down(i, n) for (int i = n - 1; i >= 0; --i)

using namespace std;

typedef unsigned long long int u64;
typedef long long i64;
typedef vector<i64> vint;
typedef vector<i64> vi64;
typedef pair<int, int> pint;
typedef pair<i64, i64> pi64;

#define FILE_NAME "file"
#define CONTEST "rmq"
#define M_PI 3.14159265358979323846
#define MODULE 1000000007

const i64 inf = 1000000000000000LL;

i64 get(i64 a, i64 d)
{
    string s;
    while(a)
    {
        s += a%10 + '0';
        a/= 10;
    }
    i64 ans = 0;
    forn(i, s.length())
    {
        ans *= d;
        ans += s[i] - '0';

    }
    return ans;
}

string calc(i64 a, i64 d)
{
    string ans;
    while(a)
    {
        ans += (a % d) + '0';
        a/=d;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main()
{
    clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
    srand(13);
#ifdef FILE_INPUT
    freopen(FILE_NAME ".in", "r", stdin);
    freopen(FILE_NAME ".out", "w", stdout);
#endif
    string s1, s2;
    cin >> s1 >> s2;
    int d = max(*max_element(s1.begin(), s1.end()) + 1 - '0', *max_element(s2.begin(), s2.end()) + 1-'0');
    stringstream ss;
    ss << s1 << " " << s2;
    i64 a, b;
    ss >> a >> b;

    i64 a1 = get(a, d);
    i64 b1 = get(b, d);
    string ans = calc(a1 + b1, d);
    int l = ans.length();
    cout << max(l,1);
    return 0;
}

#pragma comment(linker, "/STACK:64000000")
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>

#define forn(i, n) for (int i = 0; i < n; i ++)
#define ford(i, n) for (int i = n - 1; i >= 0; i --)
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pi 3.1415926535897932
#define ll long long

using namespace std;

int get(int a){
    int maxx = 1;
    while (a > 0){
        maxx = max(maxx, (a % 10) + 1);
        a /= 10;
    }
    return maxx;
}

int main(){
    //freopen ("input.txt","rt",stdin);
    //freopen ("output.txt","wt",stdout);
    int a, b, c, maxx = 1;
    cin >> a >> b;
    c = a + b;
    maxx = max(get(a), get(b));
    int ans = 0;
    while (c > 0){
        ans ++;
        c /= maxx;
    }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#include<stdio.h>
#include<string.h>
long long int i,j=0,k,l,m1,m2,m3,m4,m,n;
int main()
{
    cin>>n>>m;
    m1=n+m;
    m2=0;
    while(n!=0)
    {
        m3=n%10;
        if(m3>m2)
            m2=m3;
        n/=10;
    }
    while(m!=0)
    {
        m3=m%10;
        if(m3>m2)
            m2=m3;
        m/=10;
    }
    m2++;
    m4=0;
    while(m1!=0)
    {
        m4++;
        m1/=m2;
    }
    cout<<m4;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <stdlib.h>

using namespace std;
// vector push_back push front top empty pop make_pair long long insert begin end
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair <int,int> > vpi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define Z size()
#define REP(i,a,b) for (int i = a; i < b; i++)
#define L length()
#define show(a) cerr << " *** " << a << endl;
#define show1(a) cerr << " /// " << a << endl;

int mun(int x)
{
	int maax = 0;
	while (x)
	{
		if (x%10 > maax)
			maax= x%10;
		x /= 10;
	}
	return maax;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin >> n >> m;
	int x = n+m;
	int low = max(mun(n),mun(m))+1;
	vi str;
	vi ptr;
	//int pp = log(n)/log(low);
	while (n)
	{
		str.PB(n%10);
		n/=10;
	}
	reverse(str.B, str.E);
	while (m)
	{
		ptr.PB(m%10);
		m/=10;
	}
	reverse(ptr.B, ptr.E);
	if (ptr.Z > str.Z)
		swap(str, ptr);
	int k = str.Z -1;
	int tag = 0;
	for (int i = ptr.Z -1; i >= 0; i--)
	{
		if (str[k] + ptr[i] >= low)
		{
			if (k -1 >= 0)
			str[k - 1] += str[k] +ptr[i] - low;
			else
				tag = 1;
		}
		k--;
	}
	while (k >= 0)
	{
		if (str[k] >= low)
		{
			if (k -1 >= 0)
			str[k - 1] += str[k] - low;
			else
				tag = 1;
		}
		k--;
	}
	cout << str.Z + (tag == 1);
}

#include<bits/stdc++.h>

#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define pi pair<int,int>
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define SORT(v) sort(all(v))
#define UN(v) SORT(v), (v).erase(unique(all(v)),v.end())
#define common(a,b) SORT(a), SORT(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b) SORT(a), SORT(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())

#define FILL(a,d) memset(a,d,sizeof(a))
#define LL long long
#define ULL unsigned long long
#define DD double
#define PI 2*acos(0.0)

#define fr0(i,n) for(int i=0;i<n;i++)
#define fr1(i,n) for(int i=1;i<=n;i++)
#define fr(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)

#define ln puts("")

// for segment tree

#define eps 1e6
#define INF (1<<28)
#define mod 1000000007

/*FOR SEGMENT TREE*/
#define lft 2*idx
#define rgt lft+1

using namespace std;

// INPUT

void sf(int &x){scanf("%d",&x);}
void sf(LL &x){scanf("%lld",&x);}
void sf(float &x){scanf("%f",&x);}
void sf(double &x){scanf("%lf",&x);}
void sf(int &x,int &y){scanf("%d%d",&x,&y);}
void sf(float &x,float &y){scanf("%f%f",&x,&y);}
void sf(double &x,double &y){scanf("%lf%lf",&x,&y);}
void sf(double &x,double &y,double &z){scanf("%lf%lf%lf",&x,&y,&z);}
void sf(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sf(LL &x,LL &y,LL &z){scanf("%lld%lld%lld",&x,&y,&z);}
void sf(float &x,float &y,float &z){scanf("%u%u%u",&x,&y,&z);}
void sf(char &x){x=getchar();}
void sf(char *s){scanf("%s",s);}
void sf(string &s){cin>>s;}

// OUTPUT

void pf(int x) {printf("%d\n",x);}
void pf(int x,int y) {printf("%d %d\n",x,y);}
void pf(int x,int y,int z) {printf("%d %d %d\n",x,y,z);}
void pf(LL x) {printf("%lld\n",x);}
void pf(float x) {printf("%u\n",x);}
void pf(double x) {printf("%.6lf\n",x);}
void pf(double x,double y) {printf("%.5lf %.5lf\n",x,y);}
void pf(char x) {printf("%c\n",x);}
void pf(char *x) {printf("%s\n",x);}
void pf(string x) {cout<<x; ln; }

template<class T> T bigmod(T b,T p,T m){if(p==0) return 1%m; T x=b; T ans=1; while(p){ if(p&1) ans=(ans*x)%m; p>>=1; x=(x*x)%m; } return ans; }
template<class T> T gcd(T x, T y){if (y==0) return x; return gcd(y,x%y);}
template <typename T> T POW(T b,T p) { if (p == 1) return b; if (p%2 == 0) { T s = POW(b,p/2); return s*s; } return b*POW(b,p-1);}
template <typename T> T modinv(T num,T m) {return bigmod(num,m-2,m);}

int mn(int a,int b){
    int an=0;
    while(a){
       an=max(an,a%10);
       a/=10;
    }
    while(b){
       an=max(an,b%10);
       b/=10;
    }
    return an;
}

int main()
{
   int a,b; sf(a,b);
   int c=mn(a,b);
   c++;
   a+=b;
   string s;
   b=0;
   while(a){
      int d=a%c;
      if(d>10) b+=2;
      else b++;
      a/=c;
   }
   pf(b);
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <climits>
#include <cctype>
#include <cmath>
#include <sstream>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <set>
#include <map>
#include <numeric>
#include <utility>
#include <deque>
#include <queue>
#include <stack>
#include <iomanip>
#include <complex>
#include <list>
#include <bitset>
#include <fstream>
#include <limits>
#include <memory.h>

using namespace std;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define SET_DIFF(x,y,z) set_difference(all(x) , all(y) , back_inserter(z))
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcount(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define FIB(x) (pow((1+sqrt(5))/2,(x))-pow((1-sqrt(5))/2,(x)))/sqrt(5)
#define EPS numeric_limits<double>::epsilon()
#define PR(x) cout << #x << " = " << (x) << endl ;
#define INF 0x3f

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

int calc(int num, int base) {
    if (num == 0)
        return 1;
    string str;
    while (num != 0) {
        int nlet = num % base;
        num /= base;
        if (nlet < 10)
            str += (nlet + '0');
    }
    return SZ(str);
}

int main() {
    std::ios_base::sync_with_stdio(false);
//#ifndef ONLINE_JUDGE
//freopen("in.txt","rt",stdin);
//// freopen("out.txt","wt",stdout);
//#endif
    int i, a = 0, b = 0, p = 0;
    string s1, s2;
    cin >> s1 >> s2;
    REP(i,SZ(s1))
        p = max(p, s1[i] - '0'), a *= 10, a += s1[i] - '0';
    REP(i,SZ(s2))
        p = max(p, s2[i] - '0'), b *= 10, b += s2[i] - '0';
    p++;
    a += b;
    cout << calc(a, p) << endl;
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <climits>
#include <cctype>
#include <cmath>
#include <sstream>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <set>
#include <map>
#include <numeric>
#include <utility>
#include <deque>
#include <queue>
#include <stack>
#include <iomanip>
#include <complex>
#include <list>
#include <bitset>
#include <fstream>
#include <limits>
#include <memory.h>

using namespace std;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define SET_DIFF(x,y,z) set_difference(all(x) , all(y) , back_inserter(z))
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcount(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define FIB(x) (pow((1+sqrt(5))/2,(x))-pow((1-sqrt(5))/2,(x)))/sqrt(5)
#define EPS numeric_limits<double>::epsilon()
#define PR(x) cout << #x << " = " << (x) << endl ;
#define INF 0x3f

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

int main() {
    std::ios_base::sync_with_stdio(false);
//#ifndef ONLINE_JUDGE
//freopen("in.txt","rt",stdin);
//// freopen("out.txt","wt",stdout);
//#endif
    int i, a = 0, b = 0, p = 0;
    string s1, s2;
    cin >> s1 >> s2;
    REP(i,SZ(s1))
        p = max(p, s1[i] - '0'), a *= 10, a += s1[i] - '0';
    REP(i,SZ(s2))
        p = max(p, s2[i] - '0'), b *= 10, b += s2[i] - '0';
    p++;
    a += b;
    cout << (int) (log(a) / log(p)) + 1 << endl;
    return 0;
}