#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 /*<<< orphan*/ scanf(char *, char *);
size_t strlen(char *);
int main() {
  char buffer[100001];
  scanf("%s", buffer);
  size_t len = strlen(buffer);
  int counters[] = {0, 0};
  for (size_t i = 0; i < len; i++)
    counters[buffer[i] == 'W']++;
  printf("%d\n", counters[0] == counters[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186d0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x186b0(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x186b0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x186b8(%rbp)
lea    -0x186c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
movq   $0x0,-0x186c8(%rbp)
mov    -0x186c8(%rbp),%rax
cmp    -0x186b8(%rbp),%rax
jae    11ee <main+0xae>
mov    -0x186c8(%rbp),%rax
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x57,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    -0x186c0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x186c0(%rbp,%rax,4)
mov    -0x186c8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x186c8(%rbp)
jmp    1196 <main+0x56>
mov    -0x186c0(%rbp),%eax
cmp    -0x186bc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x186d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x186c0,%rsp
lea    0xec1(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movq   $0x0,0x8(%rsp)
test   %rax,%rax
je     116c <main+0x3c>
cmp    $0x1,%rax
jne    1172 <main+0x42>
xor    %ecx,%ecx
jmp    11ac <main+0x7c>
xor    %eax,%eax
xor    %ecx,%ecx
jmp    11c7 <main+0x97>
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
xor    %esi,%esi
cmpb   $0x57,0x10(%rsp,%rcx,1)
sete   %sil
addl   $0x1,0x8(%rsp,%rsi,4)
movzbl 0x11(%rsp,%rcx,1),%ebx
xor    %esi,%esi
cmp    $0x57,%bl
sete   %sil
addl   $0x1,0x8(%rsp,%rsi,4)
add    $0x2,%rcx
cmp    %rcx,%rdx
jne    1180 <main+0x50>
test   $0x1,%al
je     11bf <main+0x8f>
xor    %eax,%eax
cmpb   $0x57,0x10(%rsp,%rcx,1)
sete   %al
addl   $0x1,0x8(%rsp,%rax,4)
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%eax
xor    %esi,%esi
cmp    %eax,%ecx
sete   %sil
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x186c0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100001 x i8]
%2 = alloca i64
%3 = bitcast i64* %2 to [2 x i32]*
%4 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i64 @strlen(i8* %4)
%7 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%8 = icmp eq i64 %6, 0
br i1 %8, label %30, label %9
9: ; preds = %0
%10 = and i64 %6, 1
%11 = icmp eq i64 %6, 1
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = and i64 %6, -2
br label %36
14: ; preds = %36, %9
%15 = phi i64 [ 0, %9 ], [ %54, %36 ]
%16 = icmp eq i64 %10, 0
br i1 %16, label %25, label %17
17: ; preds = %14
%18 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 %15
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 87
%21 = zext i1 %20 to i64
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
br label %25
25: ; preds = %14, %17
%26 = bitcast i64* %2 to i32*
%27 = load i32, i32* %26
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%29 = load i32, i32* %28
br label %30
30: ; preds = %0, %25
%31 = phi i32 [ %29, %25 ], [ 0, %0 ]
%32 = phi i32 [ %27, %25 ], [ 0, %0 ]
%33 = icmp eq i32 %32, %31
%34 = zext i1 %33 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
ret i32 0
36: ; preds = %36, %12
%37 = phi i64 [ 0, %12 ], [ %54, %36 ]
%38 = phi i64 [ 0, %12 ], [ %55, %36 ]
%39 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 %37
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 87
%42 = zext i1 %41 to i64
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %43
%46 = or i64 %37, 1
%47 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 87
%50 = zext i1 %49 to i64
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = add nsw i32 %52, 1
store i32 %53, i32* %51
%54 = add nuw i64 %37, 2
%55 = add i64 %38, 2
%56 = icmp eq i64 %55, %13
br i1 %56, label %14, label %36
}