#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 *, char, int);
scalar_t__ scanf(char *, char *);
int main(void) {
  char str[1024], ch, max_ch, *ptr;
  int max, len;
  while (scanf("%s", str) != EOF) {
    max = 0;
    ch = 0;
    ptr = str;
    while (*ptr) {
      for (ch = *ptr, len = 1; *++ptr == ch; len++)
        ;
      if (len > max) {
        max = len;
        max_ch = ch;
      }
    }
    printf("%c %d\n", max_ch, max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%rax
je     122d <main+0x10d>
movl   $0x0,-0x424(%rbp)
movb   $0x0,-0x411(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    -0x420(%rbp),%rax
cmpb   $0x0,(%rax)
je     120d <main+0xed>
mov    -0x420(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x411(%rbp)
movl   $0x1,-0x428(%rbp)
mov    -0x420(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x420(%rbp)
movsbl 0x1(%rax),%eax
movsbl -0x411(%rbp),%ecx
cmp    %ecx,%eax
jne    11de <main+0xbe>
jmp    11ca <main+0xaa>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    119d <main+0x7d>
mov    -0x428(%rbp),%eax
cmp    -0x424(%rbp),%eax
jle    1208 <main+0xe8>
mov    -0x428(%rbp),%eax
mov    %eax,-0x424(%rbp)
mov    -0x411(%rbp),%al
mov    %al,-0x412(%rbp)
jmp    1174 <main+0x54>
mov    -0x412(%rbp),%al
mov    -0x424(%rbp),%edx
lea    0xde3(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
lea    0xec8(%rip),%rdi
mov    %rsp,%r13
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x2e9e(%rip),%r12
cmp    (%r12),%rax
jne    1164 <main+0x44>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe98(%rip),%r14
lea    0xe8e(%rip),%r15
jmp    119d <main+0x7d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %bpl,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
je     1150 <main+0x30>
mov    (%rsp),%bl
xor    %edx,%edx
test   %bl,%bl
je     1180 <main+0x60>
mov    %r13,%rax
nopl   0x0(%rax)
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rax,%rsi,1),%ecx
add    $0x1,%rsi
cmp    %bl,%cl
je     11c0 <main+0xa0>
cmp    %edx,%esi
movzbl %bl,%edi
movzbl %bpl,%ebp
cmova  %edi,%ebp
cmova  %esi,%edx
add    %rsi,%rax
mov    %ecx,%ebx
test   %cl,%cl
jne    11b0 <main+0x90>
jmp    1180 <main+0x60>

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

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