#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int counts(string num) {
	int count = 0;
	for (int i = 0; i < size(num); i++) {
		if (num[i] != "0") count++;
	}
	return count;
}

int main() {
	for (int a, b; cin >> a >> b && a && b) {
		string stream as;
		as << a;
		string stream bs;
		bs << b;
		cout << counts(as)+counts(bs) << endl;
	}
}