    /* Great things never come from comfort zones,
    "whatever the mind of a man can conceive and believe,it can achieve." */
     
    #include <bits/stdc++.h>
    using namespace std;
 
    void my_dbg() { cout << endl; }
    template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
    { cout << ' ' << A; my_dbg(B...); }
    #define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)
 
    #define ll long long
    #define dd double
    #define scf(n) scanf("%d",&n)
    #define lscf(n) scanf("%lld",&n)
    #define lpri(n) printf("%lld ",n)
    #define pri(n) printf("%d ",(int)n)
    #define prin(n) printf("%d\n",(int)n)
    #define lprin(n) printf("%lld\n",n)
    #define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
    #define show(a) for(auto xy: a) pri(xy); printf("\n");
 
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define all(x)     x.begin(),x.end()
    #define SET(a,b) memset(a,b,sizeof(a))
    #define tc   int tt; scf(tt); while(tt--)
 
    #define inf INT_MAX
    #define ninf INT_MIN
    #define gcd __gcd
    #define bitcount(n) __builtin_popcount(n)
 
    const int mod=1e9+7;
    const int N = 1e6+7;

    int pos[N];

    int main()
    {

        int m; scf(m);

        int n; scf(n);

        int x=0;

        while(m)
            x+=m%10,m/=10;

        m=0;

        while(n)
            m+=n%10,n/=10;

        x=max(x,m);

        prin(x);
        //int a[m];

        //rep(i,0,n)scf(a[i]);



        

       
       
        

        


    }
 

 
 
 
// ABC187 - A
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>

using namespace std;

int calcSum(int num)
{
	int sum = 0, count = 0;;
	int divide[3] = {100, 10, 1};

	while(num != 0)
	{
		sum += num / divide[count];
		num = num % divide[count];
		count++;
	}

	return sum;
}

int main()
{
	int input_1, input_2, sum_1, sum_2;
	cin >> input_1 >> input_2;

	sum_1 = calcSum(input_1);
	sum_2 = calcSum(input_2);

	if( sum_1 >= sum_2 )
	{
		printf("%d\n", sum_1);
	}
	else
	{
		printf("%d\n", sum_2);
	}

	return 0;
}
