#include <bits/stdc++.h>

#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())

using namespace std;
using ll = long long;
using pii = pair<int, int>;
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b;
    cin>>a>>b;
    auto cal=[](int a) {
        int sum=0;
        while (a) {
            sum+=a%10;
            a/=10;
        }
        return sum;
    };
    cout<<max(cal(a), cal(b));
    return 0;
}


// check whether to use mod or not while using power
// if string is given initialise n with length
// cout << fixed << setprecision(12) << ans << endl;... to print decinmal values accurately

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define float long double
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define all(a) (a).begin(), (a).end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mem(v,x) memset(v,x,sizeof(v))
#define line cout<<endl;
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef set<ll> sll;
typedef priority_queue<ll> pqll;
typedef queue<ll> qll;

const ll mod = 1e9 + 7;
const ll inf = 1e16 + 7;
// const ll mxn = 1e3 + 7;
// vll adj[mxn];

ll power(ll a, ll b);
ll flcm(ll n, ll m);
ll fgcd(ll n, ll m);
ll modinv(ll x);

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	IOS
	ll n, m, k, u, v, t = 1, temp, ans = 0, flag = 1, c = 0, min_el, max_el, sum_el;
	string s, s1, s2;
	// cin >> t;
	while (t--) {
		ans = 0;
		c = 0;
		flag = 1;
		sum_el = 0;
		cin >> n >> m;
		ll sum1 = 0, sum2 = 0;
		while (n != 0) {
			sum1 += (n % 10);
			n /= 10;
		}
		while (m != 0) {
			sum2 += (m % 10);
			m /= 10;
		}
		cout << max(sum1, sum2) << endl;



	}
	return 0;
}

ll power(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b % 2) {
			res = (res * a) % mod;
		}
		a = (a * a) % mod;
		b /= 2;
	}
	return res;
}

ll flcm(ll n, ll m) {

	ll temp = fgcd(n, m);
	return (n * m) / temp;
}

ll fgcd(ll n, ll m) {
	ll temp;
	while (m != 0) {
		temp = n;
		n = m;
		m = temp % m;
	}
	return n;
}

ll modinv(ll x) {
	return power(x, mod - 2);
}


// ctrl j to combine lines
// ctrl l to select line
// ctrl shift arrows for moving selected lines