#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, char *);
int main(void) {
  char buf[1000], *pos;
  int words, flag;
  while (scanf(" %[^\n]", buf) != EOF) {
    words = 0;
    flag = 0;
    for (pos = buf; *pos != '\0'; pos++) {
      if ((*pos >= 'A' && *pos <= 'Z') || (*pos >= 'a' && *pos <= 'z')) {
        if (flag)
          continue;
        else {
          flag = 1;
          ++words;
        }
      } else if (flag)
        flag = 0;
    }
    printf("%d\n", words);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%rax
je     1255 <main+0x135>
movl   $0x0,-0x3fc(%rbp)
movl   $0x0,-0x400(%rbp)
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x3f8(%rbp)
mov    -0x3f8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     123e <main+0x11e>
mov    -0x3f8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     11b0 <main+0x90>
mov    -0x3f8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jle    11d6 <main+0xb6>
mov    -0x3f8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1206 <main+0xe6>
mov    -0x3f8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1206 <main+0xe6>
cmpl   $0x0,-0x400(%rbp)
je     11e8 <main+0xc8>
jmp    1227 <main+0x107>
movl   $0x1,-0x400(%rbp)
mov    -0x3fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3fc(%rbp)
jmp    1222 <main+0x102>
cmpl   $0x0,-0x400(%rbp)
je     121d <main+0xfd>
movl   $0x0,-0x400(%rbp)
jmp    1222 <main+0x102>
jmp    1227 <main+0x107>
mov    -0x3f8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x3f8(%rbp)
jmp    1177 <main+0x57>
mov    -0x3fc(%rbp),%esi
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3e8,%rsp
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2ea1(%rip),%r12
cmp    (%r12),%rax
jne    1161 <main+0x41>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1(%rsp),%r13
lea    0xe9a(%rip),%r14
lea    0xe8c(%rip),%r15
mov    %rsp,%rbx
xor    %ebp,%ebp
jmp    1199 <main+0x79>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
je     114d <main+0x2d>
mov    (%rsp),%cl
mov    $0x0,%esi
test   %cl,%cl
je     1180 <main+0x60>
xor    %edx,%edx
mov    %r13,%rax
xor    %esi,%esi
nopl   0x0(%rax)
and    $0xdf,%cl
add    $0xbf,%cl
xor    $0x1,%edx
xor    %edi,%edi
cmp    $0x1a,%cl
setb   %dil
cmovae %ebp,%edx
add    %edx,%esi
movzbl (%rax),%ecx
add    $0x1,%rax
mov    %edi,%edx
test   %cl,%cl
jne    11b0 <main+0x90>
jmp    1180 <main+0x60>

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

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