#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *, int *);
int main() {
  int a, b;
  while (scanf("%d%d", &a, &b) == 2) {
    if (!a && !b) {
      break;
    }
    int c = 0, ans = 0, i = 0;
    for (i = 0; i < 9; i++) {
      c = (a % 10 + b % 10 + c) > 9 ? 1 : 0;
      a = a / 10;
      b = b / 10;
      ans += c;
    }
    printf("%d\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1205 <main+0xe5>
cmpl   $0x0,-0x8(%rbp)
jne    1165 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    1165 <main+0x45>
jmp    1205 <main+0xe5>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    11f1 <main+0xd1>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x1c(%rbp),%edx
add    %eax,%edx
add    -0x10(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x9,%edx
cmovg  %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1181 <main+0x61>
mov    -0x14(%rbp),%esi
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    120a <main+0xea>
lea    0xeb2(%rip),%r14
lea    0xea6(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    %eax,%edx
or     %ecx,%edx
je     120a <main+0xea>
xor    %esi,%esi
mov    $0x9,%r8d
xor    %edi,%edi
nopl   0x0(%rax)
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ebx
add    %edi,%ebx
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rcx
add    %edi,%ecx
lea    (%rcx,%rcx,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %edi,%edx
add    %ebx,%edx
xor    %edi,%edi
cmp    $0xa,%edx
setge  %dil
add    %edi,%esi
add    $0xffffffff,%r8d
jne    1190 <main+0x70>
mov    %eax,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
je     1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %42, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %45
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %13
br label %45
17: ; preds = %13, %10
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %18
18: ; preds = %39, %17
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 9
br i1 %20, label %21, label %42
21: ; preds = %18
%22 = load i32, i32* %2
%23 = srem i32 %22, 10
%24 = load i32, i32* %3
%25 = srem i32 %24, 10
%26 = add nsw i32 %23, %25
%27 = load i32, i32* %4
%28 = add nsw i32 %26, %27
%29 = icmp sgt i32 %28, 9
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 1, i32 0
store i32 %31, i32* %4
%32 = load i32, i32* %2
%33 = sdiv i32 %32, 10
store i32 %33, i32* %2
%34 = load i32, i32* %3
%35 = sdiv i32 %34, 10
store i32 %35, i32* %3
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = add nsw i32 %37, %36
store i32 %38, i32* %5
br label %39
39: ; preds = %21
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %18
42: ; preds = %18
%43 = load i32, i32* %5
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %7
45: ; preds = %16, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %34
7: ; preds = %0, %30
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %13, label %34
13: ; preds = %7, %13
%14 = phi i32 [ %28, %13 ], [ 0, %7 ]
%15 = phi i32 [ %27, %13 ], [ 0, %7 ]
%16 = phi i32 [ %24, %13 ], [ 0, %7 ]
%17 = phi i32 [ %25, %13 ], [ %8, %7 ]
%18 = phi i32 [ %26, %13 ], [ %10, %7 ]
%19 = srem i32 %17, 10
%20 = srem i32 %18, 10
%21 = add nsw i32 %19, %16
%22 = add nsw i32 %21, %20
%23 = icmp sgt i32 %22, 9
%24 = zext i1 %23 to i32
%25 = sdiv i32 %17, 10
%26 = sdiv i32 %18, 10
%27 = add nuw nsw i32 %15, %24
%28 = add nuw nsw i32 %14, 1
%29 = icmp eq i32 %28, 9
br i1 %29, label %30, label %13
30: ; preds = %13
store i32 %25, i32* %1
store i32 %26, i32* %2
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%32 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%33 = icmp eq i32 %32, 2
br i1 %33, label %7, label %34
34: ; preds = %30, %7, %0
ret i32 0
}