#include <stdio.h>
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORREV(i, n) for (int i = (n - 1); i >= 0; i--)
#define FORA(i, a, n) for (int i = a; i <= n; i++)
#define INF 1000000000
typedef long long int ll;
typedef unsigned long long int ull;

int sumOfDigits(int N)
{
    int sum = 0;

    while (N > 0)
    {
        sum += (N % 10);
        N /= 10;
    }

    return sum;
}

int main()
{
    int A, B;
    scanf("%d %d", &A, &B);

    (sumOfDigits(A) > sumOfDigits(B)) ? printf("%d\n", sumOfDigits(A)) : printf("%d\n", sumOfDigits(B));

    return 0;
}
#include<bits/stdc++.h>
#include<math.h>
#include<set>

using namespace std;

#define ll                 long long
#define faster             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define line               "\n"
#define sp                 " "

void sol() {
	string a, b;
	cin >> a >> b;
	int sum_1 = 0, sum_2 = 0;

	for (auto s : a)
		sum_1 += (s - '0');

	for (auto s : b)
		sum_2 += (s - '0');

	cout << max(sum_1, sum_2) << line;
}

int main()
{
	faster
	// int t;
	// cin >> t;
	// while (t--)
	sol();

	return 0;
}


