#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 */
typedef int /*<<< orphan*/ in;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char in[4096];
  char *p1;
  int r = 0, g = 0, b = 0;
  fgets(in, sizeof(in), stdin);
  if (in[strlen(in) - 1] == '\n')
    in[strlen(in) - 1] = '\0';
  r = g = b = 0;
  p1 = in;
  while (*p1) {
    switch (*p1) {
    case 'R':
      r++;
      break;
    case 'G':
      g++;
      break;
    case 'B':
      b++;
      break;
    default:
      break;
    }
    p1++;
  }
  r %= 2;
  g %= 2;
  b %= 2;
  printf("%d\n", r + g + b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x101c(%rbp)
movl   $0x0,-0x1020(%rbp)
movl   $0x0,-0x1024(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1050 <fgets@plt>
lea    -0x1010(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x1010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    11b5 <main+0x85>
lea    -0x1010(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x1010(%rbp,%rax,1)
movl   $0x0,-0x1024(%rbp)
movl   $0x0,-0x1020(%rbp)
movl   $0x0,-0x101c(%rbp)
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1018(%rbp)
mov    -0x1018(%rbp),%rax
cmpb   $0x0,(%rax)
je     128f <main+0x15f>
mov    -0x1018(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1028(%rbp)
sub    $0x42,%eax
je     125f <main+0x12f>
jmp    120f <main+0xdf>
mov    -0x1028(%rbp),%eax
sub    $0x47,%eax
je     124b <main+0x11b>
jmp    1223 <main+0xf3>
mov    -0x1028(%rbp),%eax
sub    $0x52,%eax
jne    1273 <main+0x143>
jmp    1237 <main+0x107>
mov    -0x101c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x101c(%rbp)
jmp    1278 <main+0x148>
mov    -0x1020(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1020(%rbp)
jmp    1278 <main+0x148>
mov    -0x1024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1024(%rbp)
jmp    1278 <main+0x148>
jmp    1278 <main+0x148>
mov    -0x1018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1018(%rbp)
jmp    11e1 <main+0xb1>
mov    -0x101c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x101c(%rbp)
mov    -0x1020(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1020(%rbp)
mov    -0x1024(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1024(%rbp)
mov    -0x101c(%rbp),%esi
add    -0x1020(%rbp),%esi
add    -0x1024(%rbp),%esi
lea    0xd1c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1000,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1171 <main+0x41>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    (%rsp),%bl
test   %bl,%bl
je     11c5 <main+0x95>
lea    0x1(%rsp),%rdx
xor    %esi,%esi
xor    %eax,%eax
xor    %ecx,%ecx
jmp    119e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%esi
movzbl (%rdx),%ebx
add    $0x1,%rdx
test   %bl,%bl
je     11cb <main+0x9b>
movsbl %bl,%edi
cmp    $0x42,%edi
je     1190 <main+0x60>
cmp    $0x47,%edi
je     11c0 <main+0x90>
cmp    $0x52,%edi
jne    1193 <main+0x63>
add    $0x1,%ecx
jmp    1193 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
jmp    1193 <main+0x63>
xor    %ecx,%ecx
xor    %eax,%eax
xor    %esi,%esi
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
and    $0xfffffffe,%edx
sub    %edx,%ecx
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
and    $0xfffffffe,%edx
sub    %edx,%eax
add    %ecx,%eax
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%esi
add    %eax,%esi
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 4096, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = call i32 @strlen(i8* %2)
%13 = add nsw i32 %12, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %11, %0
%17 = load i8, i8* %2
%18 = icmp eq i8 %17, 0
br i1 %18, label %39, label %19
19: ; preds = %16, %32
%20 = phi i8 [ %37, %32 ], [ %17, %16 ]
%21 = phi i32 [ %35, %32 ], [ 0, %16 ]
%22 = phi i32 [ %34, %32 ], [ 0, %16 ]
%23 = phi i32 [ %33, %32 ], [ 0, %16 ]
%24 = phi i8* [ %36, %32 ], [ %2, %16 ]
%25 = sext i8 %20 to i32
switch i32 %25, label %32 [
i32 82, label %26
i32 71, label %28
i32 66, label %30
]
26: ; preds = %19
%27 = add nsw i32 %23, 1
br label %32
28: ; preds = %19
%29 = add nsw i32 %22, 1
br label %32
30: ; preds = %19
%31 = add nsw i32 %21, 1
br label %32
32: ; preds = %19, %30, %28, %26
%33 = phi i32 [ %23, %19 ], [ %23, %30 ], [ %23, %28 ], [ %27, %26 ]
%34 = phi i32 [ %22, %19 ], [ %22, %30 ], [ %29, %28 ], [ %22, %26 ]
%35 = phi i32 [ %21, %19 ], [ %31, %30 ], [ %21, %28 ], [ %21, %26 ]
%36 = getelementptr inbounds i8, i8* %24, i64 1
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 0
br i1 %38, label %39, label %19
39: ; preds = %32, %16
%40 = phi i32 [ 0, %16 ], [ %33, %32 ]
%41 = phi i32 [ 0, %16 ], [ %34, %32 ]
%42 = phi i32 [ 0, %16 ], [ %35, %32 ]
%43 = srem i32 %40, 2
%44 = srem i32 %41, 2
%45 = srem i32 %42, 2
%46 = add nsw i32 %44, %43
%47 = add nsw i32 %46, %45
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
ret i32 0
}