#include<bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-10
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdd;
int x[1005],y[1005];
int main(){
    string s,t;cin>>s>>t;
    int ns=0,nt=0;
    for(int i=0;i<s.length();i++){
        ns+=(s[i]-'0');
        nt+=(t[i]-'0');
    }
    cout<<max(ns,nt)<<endl;
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template <class T>
using idx_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define ull unsigned long long
#define arr array
#define vt vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()
#define pi acosl(-1)

//ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

int s(int a)
{
	int c = 0;
	while (a)
	{
		c += a % 10;
		a /= 10;
	}
	return c;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int a, b, c, d;
	cin >> a >> b;
	c = s(a), d = s(b);
	cout << (c >= d ? c : d) << '\n';
}


