#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i, max, count, remove;
  char string[1000000];
  fflush(stdin);
  while (gets(string) != NULL) {
    max = count = remove = 0;
    for (i = 0; string[i]; i++) {
      if (string[i] == ' ')
        count++;
      else {
        max = max < count ? count : max;
        count = 0;
      }
    }
    while (max != 1) {
      max = max / 2 + max % 2;
      remove++;
    }
    printf("%d\n", remove);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    -0xf4260(%rbp),%rdi
call   1040 <gets@plt>
cmp    $0x0,%rax
je     125c <main+0x12c>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmpb   $0x0,-0xf4260(%rbp,%rax,1)
je     1204 <main+0xd4>
movslq -0x14(%rbp),%rax
movsbl -0xf4260(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    11be <main+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f1 <main+0xc1>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d8 <main+0xa8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xf4264(%rbp)
jmp    11e1 <main+0xb1>
mov    -0x18(%rbp),%eax
mov    %eax,-0xf4264(%rbp)
mov    -0xf4264(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
jmp    11f6 <main+0xc6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1189 <main+0x59>
jmp    1209 <main+0xd9>
cmpl   $0x1,-0x18(%rbp)
je     1248 <main+0x118>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xf4268(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xf4268(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1209 <main+0xd9>
mov    -0x20(%rbp),%esi
lea    0xdae(%rip),%rdi
call   1030 <printf@plt>
jmp    1157 <main+0x27>
xor    %eax,%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf4240,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11e9 <main+0xb9>
xor    %edx,%edx
lea    0xe9c(%rip),%r14
mov    %rsp,%r15
xor    %ecx,%ecx
jmp    1179 <main+0x49>
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%ecx
cmovl  %ebx,%ecx
add    $0x1,%rdx
xor    %ebx,%ebx
mov    (%rsp,%rdx,1),%al
cmp    $0x20,%al
je     11e0 <main+0xb0>
test   %al,%al
jne    1170 <main+0x40>
xor    %ebx,%ebx
mov    $0x0,%esi
cmp    $0x1,%ecx
je     11ba <main+0x8a>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
mov    %eax,%edx
and    $0xfffffffe,%edx
sub    %edx,%ecx
sar    %eax
add    %eax,%ecx
add    $0x1,%esi
cmp    $0x1,%ecx
jne    11a0 <main+0x70>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
call   1040 <gets@plt>
mov    $0x0,%edx
mov    $0x0,%ecx
test   %rax,%rax
jne    117b <main+0x4b>
jmp    11e9 <main+0xb9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%rdx
jmp    117b <main+0x4b>
xor    %eax,%eax
add    $0xf4240,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [1000000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* @stdin
%12 = call i32 @fflush(i32 %11)
br label %13
13: ; preds = %60, %2
%14 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 0
%15 = call i32* @gets(i8* %14)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %63
17: ; preds = %13
store i32 0, i32* %9
store i32 0, i32* %8
store i32 0, i32* %7
store i32 0, i32* %6
br label %18
18: ; preds = %45, %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %24, label %48
24: ; preds = %18
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 32
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %44
34: ; preds = %24
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32, i32* %8
br label %42
40: ; preds = %34
%41 = load i32, i32* %7
br label %42
42: ; preds = %40, %38
%43 = phi i32 [ %39, %38 ], [ %41, %40 ]
store i32 %43, i32* %7
store i32 0, i32* %8
br label %44
44: ; preds = %42, %31
br label %45
45: ; preds = %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %18
48: ; preds = %18
br label %49
49: ; preds = %52, %48
%50 = load i32, i32* %7
%51 = icmp ne i32 %50, 1
br i1 %51, label %52, label %60
52: ; preds = %49
%53 = load i32, i32* %7
%54 = sdiv i32 %53, 2
%55 = load i32, i32* %7
%56 = srem i32 %55, 2
%57 = add nsw i32 %54, %56
store i32 %57, i32* %7
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
br label %49
60: ; preds = %49
%61 = load i32, i32* %9
%62 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %61)
br label %13
63: ; preds = %13
ret i32 0
}

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