#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*/ str;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  int i, j;
  int count;
  char str[100001];
  scanf("%d", &t);
  if ((t < 1) || (t > 10)) {
    printf("error: T does not satisfy problem constraint (1 <= T <= 10). You "
           "entered %d\n",
           t);
    return 0;
  }
  for (i = 0; i < t; i++) {
    memset(str, '\0', sizeof(str));
    scanf("%s", str);
    count = 0;
    for (j = 1; str[j] != '\0'; j++) {
      if (str[j] == str[j - 1]) {
        count++;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     1168 <main+0x38>
cmpl   $0xa,-0x8(%rbp)
jle    1183 <main+0x53>
mov    -0x8(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1246 <main+0x116>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    123f <main+0x10f>
lea    -0x186c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x186a1,%edx
call   1040 <memset@plt>
lea    -0x186c0(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
movslq -0x10(%rbp),%rax
movsbl -0x186c0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1222 <main+0xf2>
movslq -0x10(%rbp),%rax
movsbl -0x186c0(%rbp,%rax,1),%eax
ff
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x186c0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    120f <main+0xdf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xe4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11cc <main+0x9c>
mov    -0x14(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186b8,%rsp
lea    0xeb8(%rip),%rdi
xor    %ebx,%ebx
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0xb(%rsi),%eax
cmp    $0xfffffff6,%eax
jae    1182 <main+0x52>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x186b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x12(%rsp),%r13
lea    0x10(%rsp),%r12
lea    0xebd(%rip),%r14
lea    0xeb2(%rip),%r15
jmp    11b3 <main+0x83>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jge    116e <main+0x3e>
xor    %ebp,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x186a1,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x11(%rsp),%al
test   %al,%al
je     11a0 <main+0x70>
xor    %ebp,%ebp
mov    %r13,%rcx
xchg   %ax,%ax
xor    %edx,%edx
cmp    -0x2(%rcx),%al
sete   %dl
add    %edx,%ebp
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    11e0 <main+0xb0>
jmp    11a0 <main+0x70>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [77 x i8] c"error: T does not satisfy problem constraint (1 <= T <= 10). You entered %d\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100001 x i8]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %10, %0
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store i32 0, i32* %1
br label %60
16: ; preds = %10
store i32 0, i32* %3
br label %17
17: ; preds = %56, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %59
21: ; preds = %17
%22 = getelementptr inbounds [100001 x i8], [100001 x i8]* %6, i64 0, i64 0
%23 = call i32 @memset(i8* %22, i8 signext 0, i32 100001)
%24 = getelementptr inbounds [100001 x i8], [100001 x i8]* %6, i64 0, i64 0
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
store i32 0, i32* %5
store i32 1, i32* %4
br label %26
26: ; preds = %50, %21
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100001 x i8], [100001 x i8]* %6, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %53
33: ; preds = %26
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100001 x i8], [100001 x i8]* %6, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = load i32, i32* %4
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100001 x i8], [100001 x i8]* %6, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %38, %44
br i1 %45, label %46, label %49
46: ; preds = %33
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %49
49: ; preds = %46, %33
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %26
53: ; preds = %26
%54 = load i32, i32* %5
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %53
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %17
59: ; preds = %17
store i32 0, i32* %1
br label %60
60: ; preds = %59, %13
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [77 x i8] c"error: T does not satisfy problem constraint (1 <= T <= 10). You entered %d\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100001 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -11
%8 = icmp ult i32 %7, -10
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 1
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %39
13: ; preds = %9, %33
%14 = phi i32 [ 0, %9 ], [ %36, %33 ]
%15 = call i32 @memset(i8* %4, i8 signext 0, i32 100001)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%17 = load i8, i8* %10
%18 = icmp eq i8 %17, 0
br i1 %18, label %33, label %19
19: ; preds = %13, %19
%20 = phi i64 [ %29, %19 ], [ 1, %13 ]
%21 = phi i8 [ %31, %19 ], [ %17, %13 ]
%22 = phi i32 [ %28, %19 ], [ 0, %13 ]
%23 = add nsw i64 %20, -1
%24 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %21, %25
%27 = zext i1 %26 to i32
%28 = add nuw nsw i32 %22, %27
%29 = add nuw nsw i64 %20, 1
%30 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
br i1 %32, label %33, label %19
33: ; preds = %19, %13
%34 = phi i32 [ 0, %13 ], [ %28, %19 ]
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = add nuw nsw i32 %14, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %36, %37
br i1 %38, label %13, label %39
39: ; preds = %33, %11
ret i32 0
}