import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//定义两个整形变量用来存储 到时候读入整数a和b
int a = 0, b = 0;
while (sc.hasNext()) {
a = sc.nextInt();
b = sc.nextInt();
//count存放一共有多少次进位,jw存放上次的计算是否有进位
int count=0,jw=0;
if (a == 0 && b == 0){
break;
}
for (int i=0;i<=9;i++){
jw=a%10+b%10+jw>=10?1:0;
count+=jw;
a/=10;
b/=10;
}
System.out.println(count);
}
}
}