#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ strlen(char *);
int main(void) {
  char number[1000000 + 1];
  int len, result;
  while (1) {
    gets(number);
    if (number[0] == 'E')
      break;
    len = (int)strlen(number);
    if (len == 1) {
      if (number[0] == '1')
        result = 1;
      else
        result = 2;
    } else {
      if (len < 10)
        result = 3;
      else
        result = 4;
    }
    printf("%d\n", result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4260,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf4250(%rbp),%rdi
call   1050 <gets@plt>
movsbl -0xf4250(%rbp),%eax
cmp    $0x45,%eax
jne    1163 <main+0x33>
jmp    11f2 <main+0xc2>
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xf4254(%rbp)
cmpl   $0x1,-0xf4254(%rbp)
jne    11b0 <main+0x80>
movsbl -0xf4250(%rbp),%eax
cmp    $0x31,%eax
jne    11a1 <main+0x71>
movl   $0x1,-0xf4258(%rbp)
jmp    11ab <main+0x7b>
movl   $0x2,-0xf4258(%rbp)
jmp    11db <main+0xab>
cmpl   $0xa,-0xf4254(%rbp)
jge    11cc <main+0x9c>
movl   $0x3,-0xf4258(%rbp)
jmp    11d6 <main+0xa6>
movl   $0x4,-0xf4258(%rbp)
jmp    11db <main+0xab>
mov    -0xf4258(%rbp),%esi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0xf4260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf4250,%rsp
mov    %rsp,%rdi
call   1050 <gets@plt>
mov    (%rsp),%bl
cmp    $0x45,%bl
je     11a5 <main+0x75>
mov    %rsp,%r15
lea    0xeaa(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <strlen@plt>
xor    %ecx,%ecx
cmp    $0x31,%bl
sete   %cl
mov    $0x2,%edx
sub    %ecx,%edx
xor    %ecx,%ecx
cmp    $0xa,%eax
setl   %cl
mov    $0x4,%esi
sub    %ecx,%esi
cmp    $0x1,%eax
cmove  %edx,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1050 <gets@plt>
movzbl (%rsp),%ebx
cmp    $0x45,%bl
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0xf4250,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000001 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %33
%6 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 69
br i1 %11, label %12, label %13
12: ; preds = %5
br label %36
13: ; preds = %5
%14 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%15 = call i64 @strlen(i8* %14)
%16 = trunc i64 %15 to i32
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %27
19: ; preds = %13
%20 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 49
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 1, i32* %4
br label %26
25: ; preds = %19
store i32 2, i32* %4
br label %26
26: ; preds = %25, %24
br label %33
27: ; preds = %13
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 3, i32* %4
br label %32
31: ; preds = %27
store i32 4, i32* %4
br label %32
32: ; preds = %31, %30
br label %33
33: ; preds = %32, %26
%34 = load i32, i32* %4
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
br label %5
36: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [1000001 x i8]
%2 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 69
br i1 %5, label %20, label %6
6: ; preds = %0, %6
%7 = phi i8 [ %18, %6 ], [ %4, %0 ]
%8 = call i64 @strlen(i8* %2)
%9 = trunc i64 %8 to i32
%10 = icmp eq i32 %9, 1
%11 = icmp eq i8 %7, 49
%12 = select i1 %11, i32 1, i32 2
%13 = icmp slt i32 %9, 10
%14 = select i1 %13, i32 3, i32 4
%15 = select i1 %10, i32 %12, i32 %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @gets(i8* %2)
%18 = load i8, i8* %2
%19 = icmp eq i8 %18, 69
br i1 %19, label %20, label %6
20: ; preds = %6, %0
ret i32 0
}