//
// Created by K R, Siva Kumar on 02/01/21 at 5:31 PM.
//
#include <bits/stdc++.h>

using namespace std;

const double pi = 2 * acos(0.0);
const int mod = 1e9 + 7;

class Solver {
  string a, b;
public:
  void solve() {
    cin >> a >> b;

    int aa = 0, bb = 0;
    for (auto i : a) {
      aa += (i - '0');
    }

    for (auto i : b) bb += (i - '0');

    cout << max(aa, bb);

  }
};

int main() {
#ifndef ONLINE_JUDGE
  freopen("/Users/sivkr/Workspace/CompetitiveProgramming/HackerEarth/1.txt",
          "r", stdin);
  freopen("/Users/sivkr/Workspace/CompetitiveProgramming/HackerEarth/2.txt",
          "w", stdout);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  Solver s;
  s.solve();
}


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

int main(){
	int a,b;
	cin>>a>>b;
	int sum_a = 0;
	int sum_b = 0;
	while(a){
		sum_a += a%10;
		a = a/10;
		sum_b += b%10;
		b = b/10;
	}

	cout<<max(sum_a,sum_b)<<endl;
	return 0;
}