#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 **);
int strlen(char *);
main() {
  int i, conta = 0;
  char string[501];
  scanf("%s", &string);
  for (i = 0; i < strlen(string); i++) {
    if (string[i] == 'P' || string[i] == 'p')
      conta = conta + 1;
  }
  printf("%d\n", conta);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x210(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x214(%rbp),%eax
cmp    %ecx,%eax
jge    11ce <main+0x9e>
movslq -0x8(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x50,%eax
je     11b2 <main+0x82>
movslq -0x8(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x70,%eax
jne    11bb <main+0x8b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <main+0x90>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1163 <main+0x33>
mov    -0xc(%rbp),%esi
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xebe(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1192 <main+0x62>
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %ebp,%ebp
jmp    1183 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1194 <main+0x64>
movzbl (%rsp,%rbx,1),%eax
or     $0x20,%al
cmp    $0x70,%al
jne    1170 <main+0x40>
add    $0x1,%ebp
jmp    1170 <main+0x40>
xor    %ebp,%ebp
lea    0xe68(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
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 i32
%3 = alloca i32
%4 = alloca [501 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
%5 = bitcast [501 x i8]* %4 to i8**
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
store i32 0, i32* %2
br label %7
7: ; preds = %30, %0
%8 = load i32, i32* %2
%9 = getelementptr inbounds [501 x i8], [501 x i8]* %4, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %33
12: ; preds = %7
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [501 x i8], [501 x i8]* %4, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 80
br i1 %18, label %26, label %19
19: ; preds = %12
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [501 x i8], [501 x i8]* %4, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 112
br i1 %25, label %26, label %29
26: ; preds = %19, %12
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %29
29: ; preds = %26, %19
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %7
33: ; preds = %7
%34 = load i32, i32* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
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 [501 x i8]
%2 = getelementptr inbounds [501 x i8], [501 x i8]* %1, i64 0, i64 0
%3 = bitcast [501 x i8]* %1 to i8**
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0, %14
%8 = phi i64 [ %16, %14 ], [ 0, %0 ]
%9 = phi i32 [ %15, %14 ], [ 0, %0 ]
%10 = getelementptr inbounds [501 x i8], [501 x i8]* %1, i64 0, i64 %8
%11 = load i8, i8* %10
switch i8 %11, label %14 [
i8 80, label %12
i8 112, label %12
]
12: ; preds = %7, %7
%13 = add nsw i32 %9, 1
br label %14
14: ; preds = %7, %12
%15 = phi i32 [ %13, %12 ], [ %9, %7 ]
%16 = add nuw nsw i64 %8, 1
%17 = call i32 @strlen(i8* %2)
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %7, label %20
20: ; preds = %14, %0
%21 = phi i32 [ 0, %0 ], [ %15, %14 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}