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

int main() {
  string a, b;
  cin >> a >> b;
  auto f = [&](string s) {
    int res = 0;
    for (char c : s) res += c-'0';
    return res;
  };
  int ans = max(f(a), f(b));
  cout << ans << '\n';
  return 0;
}
/**
*
* @Author : Sindys
* Language  : C++
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue> 
#include <iomanip>
#include <map>
#include <set>
#include <limits>//numeric_limits<int>::max() ... numeric_limits<int>::min()
#include <cmath>
#include <bitset>
#include <tuple>
#include <deque>
#include <stack>

using namespace std;
#define ll                  long long
#define pii                 pair<int, int>    
#define vpii                vector<pii>       
#define vi                  vector<int>      
#define vd                  vector<double>     
#define vll                 vector<ll>       
#define INF                 1000000000
#define pb                  push_back
#define FOR(i,a,b,p)          for (int i = a; i < b; i += p)
#define ROF(i,b,a,p)          for (int i = b-1; i >= a; i -= p)
#define mp                  make_pair
#define f                   first
#define s                   second
#define FORX(a,b,n)         for (; a < b; a += n)//for every +n operation
#define ROFX(a,b,n)         for (; a > b; a -= n)//for every -n operation
const int M = 1000000007;

//memset(memo, -1, sizeof memo); // initialize DP memoization table with -1
//memset(arr, 0, sizeof arr); // to clear array of integers
// index = (index + 1) % n; // index++; if (index >= n) index = 0;
// index = (index + n - 1) % n; // index--; if (index < 0) index = n - 1;
// int ans = (int)((double)d + 0.5); // for rounding to nearest integer
ll sumdig(int a){
    ll res = 0;
    while(a>0) {
        res += a%10;
        a /= 10;
    }
    return res;
}

void solve() {
        int a, b;
        cin>>a>>b;
        if (sumdig(a) > sumdig(b)) {
            cout<<sumdig(a)<<'\n';
        }
        else {
            cout<<sumdig(b)<<'\n';
        }
     
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}
/*stuff you should look for:
-->overflow,array bounds
-->special cases n=1..
-->use printf for precision or setprecision on cout*/