#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 calculateDistance(char *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(void) {
  int T, result;
  char trash[10 + 1], word[10 + 1];
  scanf("%d", &T);
  fgets(trash, 10 + 1, stdin);
  while (T) {
    scanf("%s", word);
    if (strlen(word) == 5)
      result = 3;
    else {
      if (calculateDistance(word, "one") <= 1)
        result = 1;
      else
        result = 2;
    }
    printf("%d\n", result);
    T--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x17(%rbp),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%esi
call   1050 <fgets@plt>
cmpl   $0x0,-0x8(%rbp)
je     1210 <main+0xc0>
lea    -0x22(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x22(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x5,%eax
jne    11c2 <main+0x72>
movl   $0x3,-0xc(%rbp)
jmp    11f3 <main+0xa3>
lea    -0x22(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1070 <calculateDistance@plt>
cmp    $0x1,%eax
jg     11e7 <main+0x97>
movl   $0x1,-0xc(%rbp)
jmp    11ee <main+0x9e>
movl   $0x2,-0xc(%rbp)
jmp    11f3 <main+0xa3>
mov    -0xc(%rbp),%esi
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1188 <main+0x38>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe9e(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    0x1d(%rsp),%rdi
mov    $0xb,%esi
call   1050 <fgets@plt>
cmpl   $0x0,0xc(%rsp)
je     11fa <main+0xaa>
lea    0xe6f(%rip),%r14
lea    0x12(%rsp),%rbx
lea    0xe6a(%rip),%r15
lea    0xe5f(%rip),%r12
jmp    11bf <main+0x6f>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <printf@plt>
addl   $0xffffffff,0xc(%rsp)
je     11fa <main+0xaa>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0x3,%esi
cmp    $0x5,%eax
je     11b0 <main+0x60>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <calculateDistance@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
setl   %cl
mov    $0x2,%esi
sub    %ecx,%esi
jmp    11b0 <main+0x60>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"one\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [11 x i8]
%5 = alloca [11 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 11, i32 %8)
br label %10
10: ; preds = %27, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = icmp eq i32 %17, 5
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 3, i32* %3
br label %27
20: ; preds = %13
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%22 = call i32 @calculateDistance(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp sle i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %3
br label %26
25: ; preds = %20
store i32 2, i32* %3
br label %26
26: ; preds = %25, %24
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %3
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %2
%31 = add nsw i32 %30, -1
store i32 %31, i32* %2
br label %10
32: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"one\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [11 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %5, i32 11, i32 %8)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %26, label %12
12: ; preds = %0, %20
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%14 = call i32 @strlen(i8* %6)
%15 = icmp eq i32 %14, 5
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = call i32 @calculateDistance(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp slt i32 %17, 2
%19 = select i1 %18, i32 1, i32 2
br label %20
20: ; preds = %16, %12
%21 = phi i32 [ 3, %12 ], [ %19, %16 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
%24 = add nsw i32 %23, -1
store i32 %24, i32* %1
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %12
26: ; preds = %20, %0
ret i32 0
}