node_ids
sequencelengths
4
1.4k
edge_index
sequencelengths
1
2.22k
text
sequencelengths
4
1.4k
source
stringlengths
14
427k
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 2, 4, 13, 13, 13, 4, 13, 2, 2, 13, 13, 17, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 39, 2 ], [ 36, 6 ], [ 10, 9 ], [ 40, 9 ], [ 9, 13 ], [ 42, 16 ], [ 33, 19 ], [ 40, 23 ], [ 43, 24 ], [ 37, 24 ], [ 43, 29 ], [ 37, 29 ], [ 34, 30 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "s = input()\ng = 0\nfor c in s:\n if c == 'g':\n g += 1\np = len(s) - g\nprint((g - p) // 2)", "s = input()", "s", "input()", "input", "g = 0", "g", "0", "for c in s:\n if c == 'g':\n g += 1", "c", "s", "if c == 'g':\n g += 1", "c == 'g'", "c", "'g'", "g += 1", "g", "1", "p = len(s) - g", "p", "len(s) - g", "len(s)", "len", "s", "g", "print((g - p) // 2)", "print", "(g - p) // 2", "g - p", "g", "p", "2", "p = len(s) - g", "len(s) - g", "p", "g = 0", "0", "g", "s = input()", "input()", "s", "g += 1", "1", "g" ]
s = input() g = 0 for c in s: if c == 'g': g += 1 p = len(s) - g print((g - p) // 2)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 2, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 43, 2 ], [ 49, 6 ], [ 52, 9 ], [ 13, 12 ], [ 44, 12 ], [ 12, 16 ], [ 55, 19 ], [ 53, 23 ], [ 41, 23 ], [ 56, 23 ], [ 40, 26 ], [ 58, 29 ], [ 46, 32 ], [ 41, 34 ], [ 56, 34 ], [ 53, 34 ], [ 47, 38 ], [ 59, 38 ], [ 50, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ] ]
[ "s = input()\n\nres = 0\ng_stock = 0\nfor i in s:\n if i == 'g':\n g_stock += 1\n else:\n if g_stock > 0:\n g_stock -= 1\n else:\n res -= 1\nres += g_stock//2\nprint(res)\n", "s = input()", "s", "input()", "input", "res = 0", "res", "0", "g_stock = 0", "g_stock", "0", "for i in s:\n if i == 'g':\n g_stock += 1\n else:\n if g_stock > 0:\n g_stock -= 1\n else:\n res -= 1", "i", "s", "if i == 'g':\n g_stock += 1\n else:\n if g_stock > 0:\n g_stock -= 1\n else:\n res -= 1", "i == 'g'", "i", "'g'", "g_stock += 1", "g_stock", "1", "if g_stock > 0:\n g_stock -= 1\n else:\n res -= 1", "g_stock > 0", "g_stock", "0", "g_stock -= 1", "g_stock", "1", "res -= 1", "res", "1", "res += g_stock//2", "res", "g_stock//2", "g_stock", "2", "print(res)", "print", "res", "g_stock -= 1", "1", "g_stock", "s = input()", "input()", "s", "res += g_stock//2", "g_stock//2", "res", "res = 0", "0", "res", "g_stock = 0", "0", "g_stock", "g_stock += 1", "1", "g_stock", "res -= 1", "1", "res" ]
s = input() res = 0 g_stock = 0 for i in s: if i == 'g': g_stock += 1 else: if g_stock > 0: g_stock -= 1 else: res -= 1 res += g_stock//2 print(res)
[ 7, 0, 13, 4, 13, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 79, 2 ], [ 76, 6 ], [ 67, 8 ], [ 70, 11 ], [ 15, 14 ], [ 80, 14 ], [ 68, 18 ], [ 74, 18 ], [ 65, 18 ], [ 77, 19 ], [ 62, 19 ], [ 83, 19 ], [ 14, 22 ], [ 64, 25 ], [ 58, 28 ], [ 14, 32 ], [ 73, 35 ], [ 14, 39 ], [ 82, 42 ], [ 14, 46 ], [ 61, 49 ], [ 85, 52 ], [ 86, 56 ], [ 59, 56 ], [ 71, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ] ]
[ "S = input()\n\ng_cnt, p_cnt = 0, 0\nans = 0\nfor s in S:\n if p_cnt < g_cnt:\n if s == \"g\":\n p_cnt += 1\n ans += 1\n elif s == \"p\":\n p_cnt += 1\n else:\n if s == \"g\":\n g_cnt += 1\n elif s == \"p\":\n g_cnt += 1\n ans -= 1\nprint(ans)", "S = input()", "S", "input()", "input", "g_cnt, p_cnt = 0, 0", "g_cnt", "0", "p_cnt", "0", "ans = 0", "ans", "0", "for s in S:\n if p_cnt < g_cnt:\n if s == \"g\":\n p_cnt += 1\n ans += 1\n elif s == \"p\":\n p_cnt += 1\n else:\n if s == \"g\":\n g_cnt += 1\n elif s == \"p\":\n g_cnt += 1\n ans -= 1", "s", "S", "if p_cnt < g_cnt:\n if s == \"g\":\n p_cnt += 1\n ans += 1\n elif s == \"p\":\n p_cnt += 1\n else:\n if s == \"g\":\n g_cnt += 1\n elif s == \"p\":\n g_cnt += 1\n ans -= 1", "p_cnt < g_cnt", "p_cnt", "g_cnt", "if s == \"g\":\n p_cnt += 1\n ans += 1\n elif s == \"p\":\n p_cnt += 1\n ", "s == \"g\"", "s", "\"g\"", "p_cnt += 1", "p_cnt", "1", "ans += 1", "ans", "1", "elif s == \"p\":\n p_cnt += 1\n ", "s == \"p\"", "s", "\"p\"", "p_cnt += 1", "p_cnt", "1", "if s == \"g\":\n g_cnt += 1\n elif s == \"p\":\n g_cnt += 1\n ans -= 1", "s == \"g\"", "s", "\"g\"", "g_cnt += 1", "g_cnt", "1", "elif s == \"p\":\n g_cnt += 1\n ans -= 1", "s == \"p\"", "s", "\"p\"", "g_cnt += 1", "g_cnt", "1", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "ans += 1", "1", "ans", "g_cnt += 1", "1", "g_cnt", "p_cnt += 1", "1", "p_cnt", "p_cnt = 0, 0", "0", "p_cnt", "ans = 0", "0", "ans", "p_cnt += 1", "1", "p_cnt", "g_cnt, p_cnt = 0, 0", "0", "g_cnt", "S = input()", "input()", "S", "g_cnt += 1", "1", "g_cnt", "ans -= 1", "1", "ans" ]
S = input() g_cnt, p_cnt = 0, 0 ans = 0 for s in S: if p_cnt < g_cnt: if s == "g": p_cnt += 1 ans += 1 elif s == "p": p_cnt += 1 else: if s == "g": g_cnt += 1 elif s == "p": g_cnt += 1 ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 4, 13, 13, 14, 2, 2, 13, 17, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 41, 2 ], [ 44, 6 ], [ 42, 13 ], [ 38, 25 ], [ 47, 32 ], [ 48, 36 ], [ 39, 36 ], [ 45, 36 ], [ 38, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ] ]
[ "s=input()\nans=0\nfor index,i in enumerate(s):\n if index%2==0:\n if i==\"p\":\n ans-=1\n else:\n if i==\"g\":\n ans+=1\nprint(ans)", "s=input()", "s", "input()", "input", "ans=0", "ans", "0", "for index,i in enumerate(s):\n if index%2==0:\n if i==\"p\":\n ans-=1\n else:\n if i==\"g\":\n ans+=1", "index", "i", "enumerate(s)", "enumerate", "s", "if index%2==0:\n if i==\"p\":\n ans-=1\n else:\n if i==\"g\":\n ans+=1", "index%2==0", "index%2", "index", "2", "0", "if i==\"p\":\n ans-=1\n ", "i==\"p\"", "i", "\"p\"", "ans-=1", "ans", "1", "if i==\"g\":\n ans+=1", "i==\"g\"", "i", "\"g\"", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "ans-=1", "1", "ans", "s=input()", "input()", "s", "ans=0", "0", "ans", "ans+=1", "1", "ans" ]
s=input() ans=0 for index,i in enumerate(s): if index%2==0: if i=="p": ans-=1 else: if i=="g": ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 12, 13, 14, 2, 2, 13, 17, 2, 13, 17, 29, 17, 14, 2, 2, 13, 17, 2, 13, 17, 29, 17, 14, 2, 2, 13, 17, 2, 13, 17, 29, 17, 14, 2, 2, 13, 17, 2, 13, 17, 29, 17, 23, 13, 23, 13, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 8, 2, 2, 13, 17, 17, 17, 17, 0, 13, 4, 13, 13, 18, 13, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 12, 13, 10, 17, 13, 10, 4, 13, 10, 8, 13 ]
[ [ 89, 2 ], [ 86, 6 ], [ 90, 9 ], [ 53, 15 ], [ 55, 18 ], [ 53, 25 ], [ 55, 28 ], [ 53, 35 ], [ 55, 38 ], [ 53, 45 ], [ 55, 48 ], [ 53, 53 ], [ 55, 55 ], [ 95, 57 ], [ 61, 60 ], [ 87, 63 ], [ 101, 65 ], [ 60, 69 ], [ 98, 75 ], [ 93, 77 ], [ 102, 78 ], [ 90, 80 ], [ 60, 81 ], [ 99, 84 ], [ 96, 84 ], [ 86, 87 ], [ 89, 90 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ] ]
[ "s = input()\nn = len(s)\n\n\ndef point(c0, c1):\n if c0 == \"p\" and c1 == \"p\":\n return 0\n if c0 == \"p\" and c1 == \"g\":\n return 1\n if c0 == \"g\" and c1 == \"p\":\n return -1\n if c0 == \"g\" and c1 == \"g\":\n return 0\n\n\nanswer = 0\nfor i in range(n):\n c0 = \"g\" if i % 2 == 0 else \"p\"\n answer += point(c0, s[i])\n\nprint(answer)", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "def point(c0, c1):\n if c0 == \"p\" and c1 == \"p\":\n return 0\n if c0 == \"p\" and c1 == \"g\":\n return 1\n if c0 == \"g\" and c1 == \"p\":\n return -1\n if c0 == \"g\" and c1 == \"g\":\n return 0", "point", "if c0 == \"p\" and c1 == \"p\":\n return 0\n ", "c0 == \"p\" and c1 == \"p\"", "c0 == \"p\"", "c0", "\"p\"", "c1 == \"p\"", "c1", "\"p\"", "return 0", "0", "if c0 == \"p\" and c1 == \"g\":\n return 1\n ", "c0 == \"p\" and c1 == \"g\"", "c0 == \"p\"", "c0", "\"p\"", "c1 == \"g\"", "c1", "\"g\"", "return 1", "1", "if c0 == \"g\" and c1 == \"p\":\n return -1\n ", "c0 == \"g\" and c1 == \"p\"", "c0 == \"g\"", "c0", "\"g\"", "c1 == \"p\"", "c1", "\"p\"", "return -1", "-1", "if c0 == \"g\" and c1 == \"g\":\n return 0", "c0 == \"g\" and c1 == \"g\"", "c0 == \"g\"", "c0", "\"g\"", "c1 == \"g\"", "c1", "\"g\"", "return 0", "0", "c0", "c0", "c1", "c1", "answer = 0", "answer", "0", "for i in range(n):\n c0 = \"g\" if i % 2 == 0 else \"p\"\n answer += point(c0, s[i])", "i", "range(n)", "range", "n", "c0 = \"g\" if i % 2 == 0 else \"p\"", "c0", "\"g\" if i % 2 == 0 else \"p\"", "i % 2 == 0", "i % 2", "i", "2", "0", "\"g\"", "\"p\"", "answer += point(c0, s[i])", "answer", "point(c0, s[i])", "point", "c0", "s[i]", "s", "i", "print(answer)", "print", "answer", "n = len(s)", "len(s)", "n", "s = input()", "input()", "s", "def point(c0, c1):\n if c0 == \"p\" and c1 == \"p\":\n return 0\n if c0 == \"p\" and c1 == \"g\":\n return 1\n if c0 == \"g\" and c1 == \"p\":\n return -1\n if c0 == \"g\" and c1 == \"g\":\n return 0", "def point(c0, c1):\n if c0 == \"p\" and c1 == \"p\":\n return 0\n if c0 == \"p\" and c1 == \"g\":\n return 1\n if c0 == \"g\" and c1 == \"p\":\n return -1\n if c0 == \"g\" and c1 == \"g\":\n return 0", "point", "answer = 0", "0", "answer", "answer += point(c0, s[i])", "point(c0, s[i])", "answer", "c0 = \"g\" if i % 2 == 0 else \"p\"", "\"g\" if i % 2 == 0 else \"p\"", "c0" ]
s = input() n = len(s) def point(c0, c1): if c0 == "p" and c1 == "p": return 0 if c0 == "p" and c1 == "g": return 1 if c0 == "g" and c1 == "p": return -1 if c0 == "g" and c1 == "g": return 0 answer = 0 for i in range(n): c0 = "g" if i % 2 == 0 else "p" answer += point(c0, s[i]) print(answer)
[ 7, 15, 13, 0, 13, 12, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 12, 13, 23, 13, 13, 12, 13, 23, 13, 13, 12, 13, 23, 13, 13, 15, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 69, 4 ], [ 26, 25 ], [ 31, 30 ], [ 36, 35 ], [ 42, 41 ], [ 70, 43 ], [ 46, 45 ], [ 41, 48 ], [ 45, 54 ], [ 45, 57 ], [ 76, 61 ], [ 69, 70 ] ]
[ "#!/usr/bin/env python3\n#%% for atcoder uniittest use\nimport sys\ninput= lambda: sys.stdin.readline().rstrip()\nsys.setrecursionlimit(10**9)\ndef pin(type=int):return map(type,input().split())\ndef tupin(t=int):return tuple(pin(t))\ndef lispin(t=int):return list(pin(t))\n#%%code\n\nfrom collections import Counter\ndef resolve():\n S=input()\n c=Counter(S)\n #print(c)\n print((c[\"g\"]-c[\"p\"])//2)\n#%%submit!\nresolve()", "import sys", "sys", "input= lambda: sys.stdin.readline().rstrip()", "input", "lambda: sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "rstrip", "sys.setrecursionlimit(10**9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**9", "10", "9", "def pin(type=int):return map(type,input().split())", "pin", "type=int", "type", "int", "def tupin(t=int):return tuple(pin(t))", "tupin", "t=int", "t", "int", "def lispin(t=int):return list(pin(t))\n#%%code", "lispin", "t=int", "t", "int", "from collections import Counter", "def resolve():\n S=input()\n c=Counter(S)\n #print(c)\n print((c[\"g\"]-c[\"p\"])//2)\n#%%submit!", "resolve", "S=input()", "S", "input()", "input", "c=Counter(S)", "c", "Counter(S)", "Counter", "S", "print((c[\"g\"]-c[\"p\"])//2)", "print", "(c[\"g\"]-c[\"p\"])//2", "c[\"g\"]-c[\"p\"]", "c[\"g\"]", "c", "\"g\"", "c[\"p\"]", "c", "\"p\"", "2", "resolve()", "resolve", "def pin(type=int):return map(type,input().split())", "def pin(type=int):return map(type,input().split())", "pin", "def lispin(t=int):return list(pin(t))\n#%%code", "def lispin(t=int):return list(pin(t))\n#%%code", "lispin", "input= lambda: sys.stdin.readline().rstrip()", "lambda: sys.stdin.readline().rstrip()", "input", "def tupin(t=int):return tuple(pin(t))", "def tupin(t=int):return tuple(pin(t))", "tupin", "def resolve():\n S=input()\n c=Counter(S)\n #print(c)\n print((c[\"g\"]-c[\"p\"])//2)\n#%%submit!", "def resolve():\n S=input()\n c=Counter(S)\n #print(c)\n print((c[\"g\"]-c[\"p\"])//2)\n#%%submit!", "resolve" ]
#!/usr/bin/env python3 #%% for atcoder uniittest use import sys input= lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**9) def pin(type=int):return map(type,input().split()) def tupin(t=int):return tuple(pin(t)) def lispin(t=int):return list(pin(t)) #%%code from collections import Counter def resolve(): S=input() c=Counter(S) #print(c) print((c["g"]-c["p"])//2) #%%submit! resolve()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 2, 13, 17, 17, 0, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 2, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 80, 2 ], [ 68, 6 ], [ 77, 9 ], [ 13, 12 ], [ 81, 17 ], [ 12, 21 ], [ 62, 25 ], [ 71, 28 ], [ 72, 33 ], [ 63, 33 ], [ 81, 37 ], [ 12, 38 ], [ 65, 41 ], [ 72, 46 ], [ 63, 46 ], [ 81, 50 ], [ 12, 51 ], [ 74, 54 ], [ 75, 59 ], [ 69, 59 ], [ 66, 60 ], [ 78, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ] ]
[ "s = input()\nwin = 0\nlose = 0\nfor i in range(len(s)):\n if i % 2 == 0:\n my = \"g\"\n else:\n my = \"p\"\n if my == \"g\" and s[i] == \"p\":\n lose += 1\n elif my == 'p' and s[i] == 'g':\n win += 1\nprint(win -lose)", "s = input()", "s", "input()", "input", "win = 0", "win", "0", "lose = 0", "lose", "0", "for i in range(len(s)):\n if i % 2 == 0:\n my = \"g\"\n else:\n my = \"p\"\n if my == \"g\" and s[i] == \"p\":\n lose += 1\n elif my == 'p' and s[i] == 'g':\n win += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if i % 2 == 0:\n my = \"g\"\n else:\n my = \"p\"\n ", "i % 2 == 0", "i % 2", "i", "2", "0", "my = \"g\"", "my", "\"g\"", "my = \"p\"", "my", "\"p\"", "if my == \"g\" and s[i] == \"p\":\n lose += 1\n elif my == 'p' and s[i] == 'g':\n win += 1", "my == \"g\" and s[i] == \"p\"", "my == \"g\"", "my", "\"g\"", "s[i] == \"p\"", "s[i]", "s", "i", "\"p\"", "lose += 1", "lose", "1", "elif my == 'p' and s[i] == 'g':\n win += 1", "my == 'p' and s[i] == 'g'", "my == 'p'", "my", "'p'", "s[i] == 'g'", "s[i]", "s", "i", "'g'", "win += 1", "win", "1", "print(win -lose)", "print", "win -lose", "win", "lose", "my = \"g\"", "\"g\"", "my", "lose += 1", "1", "lose", "win = 0", "0", "win", "my = \"p\"", "\"p\"", "my", "win += 1", "1", "win", "lose = 0", "0", "lose", "s = input()", "input()", "s" ]
s = input() win = 0 lose = 0 for i in range(len(s)): if i % 2 == 0: my = "g" else: my = "p" if my == "g" and s[i] == "p": lose += 1 elif my == 'p' and s[i] == 'g': win += 1 print(win -lose)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 2, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 92, 2 ], [ 86, 6 ], [ 93, 9 ], [ 98, 11 ], [ 80, 14 ], [ 89, 17 ], [ 21, 20 ], [ 87, 23 ], [ 93, 27 ], [ 20, 28 ], [ 110, 31 ], [ 111, 35 ], [ 90, 35 ], [ 108, 35 ], [ 75, 35 ], [ 81, 36 ], [ 72, 36 ], [ 78, 36 ], [ 84, 36 ], [ 95, 38 ], [ 74, 41 ], [ 77, 44 ], [ 83, 47 ], [ 101, 50 ], [ 84, 52 ], [ 81, 52 ], [ 72, 52 ], [ 78, 52 ], [ 90, 53 ], [ 108, 53 ], [ 75, 53 ], [ 111, 53 ], [ 102, 56 ], [ 104, 59 ], [ 71, 62 ], [ 107, 65 ], [ 105, 69 ], [ 96, 69 ], [ 99, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "s=input()\nN=len(s)\n\nans=0\ng=0\np=0\nfor i in range(N):\n if s[i]==\"p\":\n p+=1\n if p>g:\n ans-=1\n p-=1\n g+=1 \n else:\n g+=1\n val=g-p\n if val==2:\n ans+=1\n g-=1\n p+=1\nprint(ans)", "s=input()", "s", "input()", "input", "N=len(s)", "N", "len(s)", "len", "s", "ans=0", "ans", "0", "g=0", "g", "0", "p=0", "p", "0", "for i in range(N):\n if s[i]==\"p\":\n p+=1\n if p>g:\n ans-=1\n p-=1\n g+=1 \n else:\n g+=1\n val=g-p\n if val==2:\n ans+=1\n g-=1\n p+=1", "i", "range(N)", "range", "N", "if s[i]==\"p\":\n p+=1\n if p>g:\n ans-=1\n p-=1\n g+=1 \n else:\n g+=1\n val=g-p\n if val==2:\n ans+=1\n g-=1\n p+=1", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "p+=1", "p", "1", "if p>g:\n ans-=1\n p-=1\n g+=1 \n ", "p>g", "p", "g", "ans-=1", "ans", "1", "p-=1", "p", "1", "g+=1", "g", "1", "g+=1", "g", "1", "val=g-p", "val", "g-p", "g", "p", "if val==2:\n ans+=1\n g-=1\n p+=1", "val==2", "val", "2", "ans+=1", "ans", "1", "g-=1", "g", "1", "p+=1", "p", "1", "print(ans)", "print", "ans", "g-=1", "1", "g", "p-=1", "1", "p", "g+=1", "1", "g", "g=0", "0", "g", "g+=1", "1", "g", "N=len(s)", "len(s)", "N", "p=0", "0", "p", "s=input()", "input()", "s", "ans-=1", "1", "ans", "ans=0", "0", "ans", "val=g-p", "g-p", "val", "ans+=1", "1", "ans", "p+=1", "1", "p", "p+=1", "1", "p" ]
s=input() N=len(s) ans=0 g=0 p=0 for i in range(N): if s[i]=="p": p+=1 if p>g: ans-=1 p-=1 g+=1 else: g+=1 val=g-p if val==2: ans+=1 g-=1 p+=1 print(ans)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 2, 2, 13, 17, 18, 13, 13, 17, 2, 2, 13, 17, 17, 0, 13, 17, 14, 2, 2, 2, 2, 13, 17, 18, 13, 13, 17, 2, 2, 18, 13, 13, 17, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 83, 2 ], [ 80, 8 ], [ 12, 11 ], [ 84, 16 ], [ 29, 19 ], [ 24, 19 ], [ 84, 20 ], [ 11, 21 ], [ 27, 24 ], [ 84, 25 ], [ 11, 26 ], [ 32, 29 ], [ 84, 30 ], [ 11, 31 ], [ 11, 38 ], [ 29, 40 ], [ 24, 40 ], [ 84, 41 ], [ 11, 42 ], [ 11, 46 ], [ 77, 50 ], [ 11, 57 ], [ 29, 59 ], [ 24, 59 ], [ 84, 60 ], [ 11, 61 ], [ 29, 65 ], [ 24, 65 ], [ 84, 66 ], [ 11, 67 ], [ 86, 71 ], [ 87, 75 ], [ 78, 75 ], [ 81, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ] ]
[ "# coding: utf-8\n# Your code here!\ns=list(input())\ncount=0\n\nfor i in range(len(s)):#偶数ならグー 奇数ならパーになる\n if s[i]=='g':\n s[i]=0\n else:\n s[i]=1\n if i&1^s[i]==1 and i&1==1:\n count+=1\n elif i&1^s[i]==1 and s[i]&1==1:\n count-=1\n else:\n pass\n\nprint(count)", "s=list(input())", "s", "list(input())", "list", "input()", "input", "count=0", "count", "0", "for i in range(len(s)):#偶数ならグー 奇数ならパーになる\n if s[i]=='g':\n s[i]=0\n else:\n s[i]=1\n if i&1^s[i]==1 and i&1==1:\n count+=1\n elif i&1^s[i]==1 and s[i]&1==1:\n count-=1\n else:\n pass", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i]=='g':\n s[i]=0\n else:\n s[i]=1\n ", "s[i]=='g'", "s[i]", "s", "i", "'g'", "s[i]=0", "s[i]", "s", "i", "0", "s[i]=1", "s[i]", "s", "i", "1", "if i&1^s[i]==1 and i&1==1:\n count+=1\n elif i&1^s[i]==1 and s[i]&1==1:\n count-=1\n else:\n pass", "i&1^s[i]==1 and i&1==1", "i&1^s[i]==1", "i&1^s[i]", "i&1", "i", "1", "s[i]", "s", "i", "1", "i&1==1", "i&1", "i", "1", "1", "count+=1", "count", "1", "elif i&1^s[i]==1 and s[i]&1==1:\n count-=1\n ", "i&1^s[i]==1 and s[i]&1==1", "i&1^s[i]==1", "i&1^s[i]", "i&1", "i", "1", "s[i]", "s", "i", "1", "s[i]&1==1", "s[i]&1", "s[i]", "s", "i", "1", "1", "count-=1", "count", "1", "print(count)", "print", "count", "count+=1", "1", "count", "count=0", "0", "count", "s=list(input())", "list(input())", "s", "count-=1", "1", "count" ]
# coding: utf-8 # Your code here! s=list(input()) count=0 for i in range(len(s)):#偶数ならグー 奇数ならパーになる if s[i]=='g': s[i]=0 else: s[i]=1 if i&1^s[i]==1 and i&1==1: count+=1 elif i&1^s[i]==1 and s[i]&1==1: count-=1 else: pass print(count)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 41, 28, 13, 13, 4, 8, 2, 13, 17, 17, 17, 0, 13, 4, 13, 13, 4, 13, 2, 2, 13, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 39, 2 ], [ 42, 8 ], [ 40, 11 ], [ 15, 14 ], [ 40, 14 ], [ 14, 19 ], [ 36, 24 ], [ 43, 32 ], [ 37, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "S = list(input())\nN = len(S)\np = sum([1 if s == \"p\" else 0 for s in S])\nprint(N//2-p)", "S = list(input())", "S", "list(input())", "list", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "1 if s == \"p\" else 0 for s in S", "for s in S", "s", "S", "for s in S", "1 if s == \"p\" else 0", "s == \"p\"", "s", "\"p\"", "1", "0", "p = sum([1 if s == \"p\" else 0 for s in S])", "p", "sum([1 if s == \"p\" else 0 for s in S])", "sum", "[1 if s == \"p\" else 0 for s in S]", "print(N//2-p)", "print", "N//2-p", "N//2", "N", "2", "p", "p = sum([1 if s == \"p\" else 0 for s in S])", "sum([1 if s == \"p\" else 0 for s in S])", "p", "S = list(input())", "list(input())", "S", "N = len(S)", "len(S)", "N" ]
S = list(input()) N = len(S) p = sum([1 if s == "p" else 0 for s in S]) print(N//2-p)
[ 7, 0, 13, 4, 18, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 21, 22, 17, 17, 22, 17, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 17, 17, 0, 18, 13, 17, 17, 0, 13, 2, 13, 17, 4, 13, 2, 13, 18, 13, 17, 10, 21, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 59, 2 ], [ 65, 9 ], [ 60, 12 ], [ 56, 14 ], [ 24, 23 ], [ 66, 26 ], [ 60, 30 ], [ 23, 31 ], [ 37, 34 ], [ 57, 35 ], [ 42, 39 ], [ 57, 40 ], [ 62, 44 ], [ 66, 46 ], [ 63, 51 ], [ 57, 53 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ] ]
[ "s = input().strip()\nN = len(s)\nC = {0:0,1:0}\nfor i in range(N):\n if s[i]==\"g\":\n C[0] += 1\n else:\n C[1] += 1\nn = N//2\nprint(n-C[1])", "s = input().strip()", "s", "input().strip()", "().strip", "()", "input", "strip", "N = len(s)", "N", "len(s)", "len", "s", "C = {0:0,1:0}", "C", "{0:0,1:0}", "0", "0", "0", "1", "1", "0", "for i in range(N):\n if s[i]==\"g\":\n C[0] += 1\n else:\n C[1] += 1", "i", "range(N)", "range", "N", "if s[i]==\"g\":\n C[0] += 1\n else:\n C[1] += 1", "s[i]==\"g\"", "s[i]", "s", "i", "\"g\"", "C[0] += 1", "C[0]", "C", "0", "1", "C[1] += 1", "C[1]", "C", "1", "1", "n = N//2", "n", "N//2", "N", "2", "print(n-C[1])", "print", "n-C[1]", "n", "C[1]", "C", "1", "C = {0:0,1:0}", "{0:0,1:0}", "C", "s = input().strip()", "input().strip()", "s", "n = N//2", "N//2", "n", "N = len(s)", "len(s)", "N" ]
s = input().strip() N = len(s) C = {0:0,1:0} for i in range(N): if s[i]=="g": C[0] += 1 else: C[1] += 1 n = N//2 print(n-C[1])
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 2, 4, 13, 13, 13, 0, 13, 2, 4, 13, 13, 17, 0, 13, 2, 13, 13, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 47, 2 ], [ 56, 6 ], [ 10, 9 ], [ 48, 9 ], [ 9, 13 ], [ 50, 16 ], [ 53, 19 ], [ 48, 23 ], [ 51, 24 ], [ 57, 24 ], [ 41, 26 ], [ 48, 30 ], [ 44, 33 ], [ 42, 35 ], [ 54, 36 ], [ 45, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ] ]
[ "s = input()\n\ng_cnt=0\nfor te in s:\n if te==\"g\":\n g_cnt+=1\np_cnt=len(s)-g_cnt\nbest_p=len(s)//2\ndiff = best_p - p_cnt\nprint(diff)", "s = input()", "s", "input()", "input", "g_cnt=0", "g_cnt", "0", "for te in s:\n if te==\"g\":\n g_cnt+=1", "te", "s", "if te==\"g\":\n g_cnt+=1", "te==\"g\"", "te", "\"g\"", "g_cnt+=1", "g_cnt", "1", "p_cnt=len(s)-g_cnt", "p_cnt", "len(s)-g_cnt", "len(s)", "len", "s", "g_cnt", "best_p=len(s)//2", "best_p", "len(s)//2", "len(s)", "len", "s", "2", "diff = best_p - p_cnt", "diff", "best_p - p_cnt", "best_p", "p_cnt", "print(diff)", "print", "diff", "best_p=len(s)//2", "len(s)//2", "best_p", "diff = best_p - p_cnt", "best_p - p_cnt", "diff", "s = input()", "input()", "s", "g_cnt+=1", "1", "g_cnt", "p_cnt=len(s)-g_cnt", "len(s)-g_cnt", "p_cnt", "g_cnt=0", "0", "g_cnt" ]
s = input() g_cnt=0 for te in s: if te=="g": g_cnt+=1 p_cnt=len(s)-g_cnt best_p=len(s)//2 diff = best_p - p_cnt print(diff)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 60, 2 ], [ 66, 6 ], [ 66, 9 ], [ 45, 12 ], [ 16, 15 ], [ 61, 15 ], [ 52, 19 ], [ 55, 19 ], [ 67, 20 ], [ 58, 20 ], [ 15, 23 ], [ 63, 26 ], [ 57, 29 ], [ 15, 33 ], [ 48, 36 ], [ 54, 39 ], [ 49, 43 ], [ 64, 43 ], [ 46, 43 ], [ 45, 46 ], [ 48, 49 ], [ 66, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ] ]
[ "S=input()\n\nG=P=0\nK=0\nfor s in S:\n if P==G:\n if s==\"p\":\n K-=1\n G+=1\n else:\n if s==\"g\":\n K+=1\n P+=1\n\nprint(K)", "S=input()", "S", "input()", "input", "G=P=0", "G", "0", "=P=0", "P", "0", "K=0", "K", "0", "for s in S:\n if P==G:\n if s==\"p\":\n K-=1\n G+=1\n else:\n if s==\"g\":\n K+=1\n P+=1", "s", "S", "if P==G:\n if s==\"p\":\n K-=1\n G+=1\n else:\n if s==\"g\":\n K+=1\n P+=1", "P==G", "P", "G", "if s==\"p\":\n K-=1\n ", "s==\"p\"", "s", "\"p\"", "K-=1", "K", "1", "G+=1", "G", "1", "if s==\"g\":\n K+=1\n ", "s==\"g\"", "s", "\"g\"", "K+=1", "K", "1", "P+=1", "P", "1", "print(K)", "print", "K", "K=0", "0", "K", "K+=1", "1", "K", "P=0", "0", "P", "P+=1", "1", "P", "G+=1", "1", "G", "S=input()", "input()", "S", "K-=1", "1", "K", "G=P=0", "0", "G" ]
S=input() G=P=0 K=0 for s in S: if P==G: if s=="p": K-=1 G+=1 else: if s=="g": K+=1 P+=1 print(K)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 14, 2, 2, 4, 13, 13, 17, 17, 4, 13, 2, 2, 13, 2, 4, 13, 13, 17, 17, 4, 13, 2, 13, 2, 4, 13, 13, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 50, 2 ], [ 47, 6 ], [ 10, 9 ], [ 51, 9 ], [ 9, 13 ], [ 53, 16 ], [ 51, 23 ], [ 54, 30 ], [ 48, 30 ], [ 51, 34 ], [ 54, 40 ], [ 48, 40 ], [ 51, 44 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ] ]
[ "S = input()\n\ncnt = 0\nfor s in S:\n if s == 'g':\n cnt += 1\n\nif len(S) % 2 == 1:\n print(cnt-len(S)//2-1)\nelse:\n print(cnt-len(S)//2)", "S = input()", "S", "input()", "input", "cnt = 0", "cnt", "0", "for s in S:\n if s == 'g':\n cnt += 1", "s", "S", "if s == 'g':\n cnt += 1", "s == 'g'", "s", "'g'", "cnt += 1", "cnt", "1", "if len(S) % 2 == 1:\n print(cnt-len(S)//2-1)\nelse:\n print(cnt-len(S)//2)", "len(S) % 2 == 1", "len(S) % 2", "len(S)", "len", "S", "2", "1", "print(cnt-len(S)//2-1)", "print", "cnt-len(S)//2-1", "cnt-len(S)//2", "cnt", "len(S)//2", "len(S)", "len", "S", "2", "1", "print(cnt-len(S)//2)", "print", "cnt-len(S)//2", "cnt", "len(S)//2", "len(S)", "len", "S", "2", "cnt = 0", "0", "cnt", "S = input()", "input()", "S", "cnt += 1", "1", "cnt" ]
S = input() cnt = 0 for s in S: if s == 'g': cnt += 1 if len(S) % 2 == 1: print(cnt-len(S)//2-1) else: print(cnt-len(S)//2)
[ 7, 15, 13, 13, 13, 13, 13, 13, 13, 13, 0, 13, 12, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 17, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 12, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 2, 4, 13, 13, 17, 12, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 2, 13, 17, 4, 18, 13, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 142, 11 ], [ 121, 30 ], [ 43, 42 ], [ 143, 46 ], [ 42, 51 ], [ 57, 56 ], [ 143, 60 ], [ 56, 66 ], [ 73, 72 ], [ 143, 76 ], [ 72, 81 ], [ 90, 89 ], [ 146, 91 ], [ 94, 93 ], [ 89, 96 ], [ 99, 98 ], [ 93, 101 ], [ 89, 105 ], [ 98, 110 ], [ 137, 116 ], [ 121, 122 ], [ 142, 143 ] ]
[ "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n s = SS()\n\n N = len(s)\n\n # 出す順番関係なし パーを出せるだけ出せば良い\n ans = N // 2 - s.count('p')\n print(ans)\n\nif __name__ == '__main__':\n resolve()", "import bisect, collections, copy, heapq, itertools, math, string, sys", "bisect", "collections", "copy", "heapq", "itertools", "math", "string", "sys", "input = lambda: sys.stdin.readline().rstrip()", "input", "lambda: sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "rstrip", "sys.setrecursionlimit(10**7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**7", "10", "7", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "def I(): return int(input())", "I", "def F(): return float(input())", "F", "def SS(): return input()", "SS", "int(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)", "int", "x", "def LI(): return [int(x) for x in input().split()]", "LI", "int(x)-1 for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)-1", "int(x)", "int", "x", "1", "def LI_(): return [int(x)-1 for x in input().split()]", "LI_", "float(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "float(x)", "float", "x", "def LF(): return [float(x) for x in input().split()]", "LF", "def LSS(): return input().split()", "LSS", "def resolve():\n s = SS()\n\n N = len(s)\n\n # 出す順番関係なし パーを出せるだけ出せば良い\n ans = N // 2 - s.count('p')\n print(ans)", "resolve", "s = SS()", "s", "SS()", "SS", "N = len(s)", "N", "len(s)", "len", "s", "ans = N // 2 - s.count('p')", "ans", "N // 2 - s.count('p')", "N // 2", "N", "2", "s.count('p')", "s.count", "s", "count", "'p'", "print(ans)", "print", "ans", "if __name__ == '__main__':\n resolve()", "__name__ == '__main__'", "__name__", "'__main__'", "resolve()", "resolve", "def LI(): return [int(x) for x in input().split()]", "def LI(): return [int(x) for x in input().split()]", "LI", "INF = float('inf')", "float('inf')", "INF", "def F(): return float(input())", "def F(): return float(input())", "F", "def LI_(): return [int(x)-1 for x in input().split()]", "def LI_(): return [int(x)-1 for x in input().split()]", "LI_", "def LF(): return [float(x) for x in input().split()]", "def LF(): return [float(x) for x in input().split()]", "LF", "def I(): return int(input())", "def I(): return int(input())", "I", "def resolve():\n s = SS()\n\n N = len(s)\n\n # 出す順番関係なし パーを出せるだけ出せば良い\n ans = N // 2 - s.count('p')\n print(ans)", "def resolve():\n s = SS()\n\n N = len(s)\n\n # 出す順番関係なし パーを出せるだけ出せば良い\n ans = N // 2 - s.count('p')\n print(ans)", "resolve", "def LSS(): return input().split()", "def LSS(): return input().split()", "LSS", "input = lambda: sys.stdin.readline().rstrip()", "lambda: sys.stdin.readline().rstrip()", "input", "def SS(): return input()", "def SS(): return input()", "SS" ]
import bisect, collections, copy, heapq, itertools, math, string, sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = float('inf') def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return [float(x) for x in input().split()] def LSS(): return input().split() def resolve(): s = SS() N = len(s) # 出す順番関係なし パーを出せるだけ出せば良い ans = N // 2 - s.count('p') print(ans) if __name__ == '__main__': resolve()
[ 7, 0, 13, 4, 18, 4, 13, 13, 0, 13, 39, 39, 17, 4, 13, 2, 2, 4, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13, 10, 39, 13 ]
[ [ 27, 2 ], [ 30, 9 ], [ 28, 19 ], [ 28, 23 ], [ 27, 28 ], [ 30, 31 ] ]
[ "s = input().strip()\ndp = [[0]]\nprint(len(s)//2-s.count('p'))", "s = input().strip()", "s", "input().strip()", "().strip", "()", "input", "strip", "dp = [[0]]", "dp", "[[0]]", "[0]", "0", "print(len(s)//2-s.count('p'))", "print", "len(s)//2-s.count('p')", "len(s)//2", "len(s)", "len", "s", "2", "s.count('p')", "s.count", "s", "count", "'p'", "s = input().strip()", "input().strip()", "s", "dp = [[0]]", "[[0]]", "dp" ]
s = input().strip() dp = [[0]] print(len(s)//2-s.count('p'))
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 2, 4, 13, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 38, 2 ], [ 29, 6 ], [ 10, 9 ], [ 39, 9 ], [ 9, 13 ], [ 32, 16 ], [ 35, 19 ], [ 39, 23 ], [ 36, 27 ], [ 33, 27 ], [ 30, 27 ], [ 29, 30 ], [ 32, 33 ], [ 35, 36 ], [ 38, 39 ] ]
[ "s=input()\nc=0\nfor i in s:\n if i==\"p\":\n c-=1\nc+=len(s)//2\nprint(c)", "s=input()", "s", "input()", "input", "c=0", "c", "0", "for i in s:\n if i==\"p\":\n c-=1", "i", "s", "if i==\"p\":\n c-=1", "i==\"p\"", "i", "\"p\"", "c-=1", "c", "1", "c+=len(s)//2", "c", "len(s)//2", "len(s)", "len", "s", "2", "print(c)", "print", "c", "c=0", "0", "c", "c-=1", "1", "c", "c+=len(s)//2", "len(s)//2", "c", "s=input()", "input()", "s" ]
s=input() c=0 for i in s: if i=="p": c-=1 c+=len(s)//2 print(c)
[ 7, 0, 13, 4, 13, 0, 13, 2, 17, 2, 2, 4, 13, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 13, 9, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 63, 2 ], [ 51, 6 ], [ 64, 13 ], [ 54, 17 ], [ 21, 20 ], [ 64, 25 ], [ 64, 29 ], [ 20, 30 ], [ 52, 32 ], [ 20, 33 ], [ 64, 38 ], [ 20, 39 ], [ 60, 42 ], [ 57, 45 ], [ 58, 49 ], [ 61, 49 ], [ 55, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ] ]
[ "s = input()\nm = \"gp\"*(len(s)//2+1)\ng = 0\nfor i in range(len(s)):\n if s[i] == m[i]:\n continue\n elif s[i] == \"p\":\n g -= 1\n else:\n g += 1\nprint(g)", "s = input()", "s", "input()", "input", "m = \"gp\"*(len(s)//2+1)", "m", "\"gp\"*(len(s)//2+1)", "\"gp\"", "len(s)//2+1", "len(s)//2", "len(s)", "len", "s", "2", "1", "g = 0", "g", "0", "for i in range(len(s)):\n if s[i] == m[i]:\n continue\n elif s[i] == \"p\":\n g -= 1\n else:\n g += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == m[i]:\n continue\n elif s[i] == \"p\":\n g -= 1\n else:\n g += 1", "s[i] == m[i]", "s[i]", "s", "i", "m[i]", "m", "i", "continue", "elif s[i] == \"p\":\n g -= 1\n ", "s[i] == \"p\"", "s[i]", "s", "i", "\"p\"", "g -= 1", "g", "1", "g += 1", "g", "1", "print(g)", "print", "g", "m = \"gp\"*(len(s)//2+1)", "\"gp\"*(len(s)//2+1)", "m", "g = 0", "0", "g", "g += 1", "1", "g", "g -= 1", "1", "g", "s = input()", "input()", "s" ]
s = input() m = "gp"*(len(s)//2+1) g = 0 for i in range(len(s)): if s[i] == m[i]: continue elif s[i] == "p": g -= 1 else: g += 1 print(g)
[ 7, 15, 13, 15, 13, 15, 13, 15, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 2, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 46, 17 ], [ 43, 21 ], [ 47, 24 ], [ 49, 26 ], [ 47, 29 ], [ 52, 33 ], [ 44, 35 ], [ 53, 40 ], [ 50, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ] ]
[ "import sys\nimport math\nimport fractions\nfrom collections import deque\nfrom collections import defaultdict\nsys.setrecursionlimit(10**7)\n\ns = input()\nsize = len(s)\np_cnt = s.count(\"p\")\n\nmax_p = size // 2\n\nprint(max_p - p_cnt)", "import sys", "sys", "import math", "math", "import fractions", "fractions", "from collections import deque", "from collections import defaultdict", "sys.setrecursionlimit(10**7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**7", "10", "7", "s = input()", "s", "input()", "input", "size = len(s)", "size", "len(s)", "len", "s", "p_cnt = s.count(\"p\")", "p_cnt", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "max_p = size // 2", "max_p", "size // 2", "size", "2", "print(max_p - p_cnt)", "print", "max_p - p_cnt", "max_p", "p_cnt", "size = len(s)", "len(s)", "size", "s = input()", "input()", "s", "p_cnt = s.count(\"p\")", "s.count(\"p\")", "p_cnt", "max_p = size // 2", "size // 2", "max_p" ]
import sys import math import fractions from collections import deque from collections import defaultdict sys.setrecursionlimit(10**7) s = input() size = len(s) p_cnt = s.count("p") max_p = size // 2 print(max_p - p_cnt)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 2, 4, 13, 13, 17, 0, 13, 2, 2, 39, 17, 13, 2, 39, 17, 13, 0, 13, 17, 28, 13, 13, 4, 13, 13, 13, 14, 40, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 58, 3 ], [ 49, 9 ], [ 59, 15 ], [ 55, 18 ], [ 50, 23 ], [ 50, 27 ], [ 61, 29 ], [ 59, 36 ], [ 56, 37 ], [ 52, 43 ], [ 53, 47 ], [ 62, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ] ]
[ "from math import ceil\n\ns = sorted(input())\nl = ceil(len(s)/2)\n\nhands = (['g'] * l) + (['p'] * l)\n\nc = 0\n\nfor x, y in zip(s, hands):\n if x != y:\n c += 1\n\nprint(c)", "from math import ceil", "s = sorted(input())", "s", "sorted(input())", "sorted", "input()", "input", "l = ceil(len(s)/2)", "l", "ceil(len(s)/2)", "ceil", "len(s)/2", "len(s)", "len", "s", "2", "hands = (['g'] * l) + (['p'] * l)", "hands", "(['g'] * l) + (['p'] * l)", "['g'] * l", "['g']", "'g'", "l", "['p'] * l", "['p']", "'p'", "l", "c = 0", "c", "0", "for x, y in zip(s, hands):\n if x != y:\n c += 1", "x", "y", "zip(s, hands)", "zip", "s", "hands", "if x != y:\n c += 1", "x != y", "x", "y", "c += 1", "c", "1", "print(c)", "print", "c", "l = ceil(len(s)/2)", "ceil(len(s)/2)", "l", "c += 1", "1", "c", "hands = (['g'] * l) + (['p'] * l)", "(['g'] * l) + (['p'] * l)", "hands", "s = sorted(input())", "sorted(input())", "s", "c = 0", "0", "c" ]
from math import ceil s = sorted(input()) l = ceil(len(s)/2) hands = (['g'] * l) + (['p'] * l) c = 0 for x, y in zip(s, hands): if x != y: c += 1 print(c)
[ 7, 15, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 13, 17, 0, 13, 4, 18, 13, 13, 13, 0, 13, 2, 13, 18, 13, 17, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 44, 4 ], [ 35, 8 ], [ 45, 11 ], [ 41, 13 ], [ 36, 15 ], [ 38, 18 ], [ 45, 23 ], [ 47, 25 ], [ 42, 27 ], [ 39, 29 ], [ 48, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ] ]
[ "import collections\n\nS = input()\nN = len(S)\nnum_p = N // 2\nc = collections.Counter(S)\nans = num_p - c['p']\nprint(ans)", "import collections", "collections", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "num_p = N // 2", "num_p", "N // 2", "N", "2", "c = collections.Counter(S)", "c", "collections.Counter(S)", "collections.Counter", "collections", "Counter", "S", "ans = num_p - c['p']", "ans", "num_p - c['p']", "num_p", "c['p']", "c", "'p'", "print(ans)", "print", "ans", "N = len(S)", "len(S)", "N", "c = collections.Counter(S)", "collections.Counter(S)", "c", "num_p = N // 2", "N // 2", "num_p", "S = input()", "input()", "S", "ans = num_p - c['p']", "num_p - c['p']", "ans" ]
import collections S = input() N = len(S) num_p = N // 2 c = collections.Counter(S) ans = num_p - c['p'] print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 8, 2, 13, 17, 17, 17, 4, 13, 2, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 8, 13, 10, 17, 13 ]
[ [ 54, 2 ], [ 48, 6 ], [ 63, 9 ], [ 45, 12 ], [ 16, 15 ], [ 55, 15 ], [ 49, 19 ], [ 61, 19 ], [ 15, 20 ], [ 49, 23 ], [ 61, 23 ], [ 57, 26 ], [ 51, 29 ], [ 60, 32 ], [ 49, 35 ], [ 61, 35 ], [ 58, 42 ], [ 64, 42 ], [ 52, 43 ], [ 46, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ] ]
[ "S = input()\n\ncur = \"g\"\nacd = 0\ntcd = 0\nfor c in S:\n if cur != c:\n if cur == \"p\":\n acd += 1\n else:\n tcd += 1\n cur = \"p\" if cur == \"g\" else \"g\"\nprint(acd - tcd)", "S = input()", "S", "input()", "input", "cur = \"g\"", "cur", "\"g\"", "acd = 0", "acd", "0", "tcd = 0", "tcd", "0", "for c in S:\n if cur != c:\n if cur == \"p\":\n acd += 1\n else:\n tcd += 1\n cur = \"p\" if cur == \"g\" else \"g\"", "c", "S", "if cur != c:\n if cur == \"p\":\n acd += 1\n else:\n tcd += 1\n ", "cur != c", "cur", "c", "if cur == \"p\":\n acd += 1\n else:\n tcd += 1\n ", "cur == \"p\"", "cur", "\"p\"", "acd += 1", "acd", "1", "tcd += 1", "tcd", "1", "cur = \"p\" if cur == \"g\" else \"g\"", "cur", "\"p\" if cur == \"g\" else \"g\"", "cur == \"g\"", "cur", "\"g\"", "\"p\"", "\"g\"", "print(acd - tcd)", "print", "acd - tcd", "acd", "tcd", "tcd = 0", "0", "tcd", "cur = \"g\"", "\"g\"", "cur", "tcd += 1", "1", "tcd", "S = input()", "input()", "S", "acd += 1", "1", "acd", "cur = \"p\" if cur == \"g\" else \"g\"", "\"p\" if cur == \"g\" else \"g\"", "cur", "acd = 0", "0", "acd" ]
S = input() cur = "g" acd = 0 tcd = 0 for c in S: if cur != c: if cur == "p": acd += 1 else: tcd += 1 cur = "p" if cur == "g" else "g" print(acd - tcd)
[ 7, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 4, 18, 4, 18, 4, 13, 13, 17, 13, 41, 28, 13, 13, 4, 4, 13, 2, 13, 17, 0, 13, 13, 12, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 29, 13, 14, 2, 13, 17, 4, 13, 4, 13, 10, 4, 13, 10, 12, 13, 10, 18, 13, 10, 18, 13, 10, 18, 13, 10, 13, 13 ]
[ [ 128, 11 ], [ 125, 20 ], [ 122, 29 ], [ 116, 38 ], [ 126, 44 ], [ 51, 50 ], [ 117, 50 ], [ 50, 56 ], [ 131, 59 ], [ 68, 64 ], [ 68, 67 ], [ 71, 70 ], [ 74, 73 ], [ 132, 73 ], [ 64, 77 ], [ 83, 77 ], [ 67, 78 ], [ 89, 78 ], [ 81, 80 ], [ 84, 83 ], [ 87, 86 ], [ 90, 89 ], [ 86, 93 ], [ 80, 93 ], [ 73, 94 ], [ 97, 96 ], [ 86, 100 ], [ 80, 100 ], [ 73, 101 ], [ 104, 103 ], [ 103, 106 ], [ 96, 106 ], [ 70, 106 ], [ 120, 114 ], [ 116, 117 ], [ 122, 123 ], [ 125, 126 ], [ 128, 129 ], [ 131, 132 ] ]
[ "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10 ** 8)\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nS = readline().decode(\"utf-8\").rstrip()\nsp = [int(h == \"p\") for h in S]\n\n\ndef solve():\n g = p = 0\n score = 0\n for is_p in sp:\n if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n return score\n\n\nif __name__ == \"__main__\":\n print(solve())", "import sys", "sys", "sys.setrecursionlimit(10 ** 8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 8", "10", "8", "read = sys.stdin.buffer.read", "read", "sys.stdin.buffer.read", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "read", "readline = sys.stdin.buffer.readline", "readline", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "readlines = sys.stdin.buffer.readlines", "readlines", "sys.stdin.buffer.readlines", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readlines", "S = readline().decode(\"utf-8\").rstrip()", "S", "readline().decode(\"utf-8\").rstrip()", "().decode(\"utf-8\").rstrip", "().decode(\"utf-8\")", "().decode", "()", "readline", "decode", "\"utf-8\"", "rstrip", "int(h == \"p\") for h in S", "for h in S", "h", "S", "for h in S", "int(h == \"p\")", "int", "h == \"p\"", "h", "\"p\"", "sp = [int(h == \"p\") for h in S]", "sp", "[int(h == \"p\") for h in S]", "def solve():\n g = p = 0\n score = 0\n for is_p in sp:\n if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n return score", "solve", "g = p = 0", "g", "0", "= p = 0", "p", "0", "score = 0", "score", "0", "for is_p in sp:\n if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n ", "is_p", "sp", "if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n ", "g == p", "g", "p", "hand = 0", "hand", "0", "g += 1", "g", "1", "hand = 1", "hand", "1", "p += 1", "p", "1", "if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n ", "hand > is_p", "hand", "is_p", "score += 1", "score", "1", "elif hand < is_p:\n score -= 1\n ", "hand < is_p", "hand", "is_p", "score -= 1", "score", "1", "return score", "score", "if __name__ == \"__main__\":\n print(solve())", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "print(solve())", "print", "solve()", "solve", "S = readline().decode(\"utf-8\").rstrip()", "readline().decode(\"utf-8\").rstrip()", "S", "def solve():\n g = p = 0\n score = 0\n for is_p in sp:\n if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n return score", "def solve():\n g = p = 0\n score = 0\n for is_p in sp:\n if g == p:\n hand = 0\n g += 1\n else:\n hand = 1\n p += 1\n if hand > is_p:\n score += 1\n elif hand < is_p:\n score -= 1\n return score", "solve", "readlines = sys.stdin.buffer.readlines", "sys.stdin.buffer.readlines", "readlines", "readline = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "readline", "read = sys.stdin.buffer.read", "sys.stdin.buffer.read", "read", "sp = [int(h == \"p\") for h in S]", "[int(h == \"p\") for h in S]", "sp" ]
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10 ** 8) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = readline().decode("utf-8").rstrip() sp = [int(h == "p") for h in S] def solve(): g = p = 0 score = 0 for is_p in sp: if g == p: hand = 0 g += 1 else: hand = 1 p += 1 if hand > is_p: score += 1 elif hand < is_p: score -= 1 return score if __name__ == "__main__": print(solve())
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 66, 2 ], [ 57, 6 ], [ 60, 9 ], [ 13, 12 ], [ 67, 12 ], [ 12, 16 ], [ 61, 20 ], [ 64, 20 ], [ 55, 20 ], [ 52, 20 ], [ 73, 20 ], [ 72, 23 ], [ 69, 26 ], [ 51, 29 ], [ 61, 33 ], [ 64, 33 ], [ 55, 33 ], [ 52, 33 ], [ 73, 33 ], [ 54, 36 ], [ 63, 39 ], [ 48, 42 ], [ 49, 46 ], [ 70, 46 ], [ 58, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ] ]
[ "S = input()\nans = 0\ng_count = 0\nfor c in S:\n if c == \"g\":\n if g_count > 0:\n g_count-=1\n ans += 1\n else:\n g_count += 1\n else:\n if g_count > 0:\n g_count-=1\n\n else:\n g_count += 1\n ans -=1\nprint(ans)", "S = input()", "S", "input()", "input", "ans = 0", "ans", "0", "g_count = 0", "g_count", "0", "for c in S:\n if c == \"g\":\n if g_count > 0:\n g_count-=1\n ans += 1\n else:\n g_count += 1\n else:\n if g_count > 0:\n g_count-=1\n\n else:\n g_count += 1\n ans -=1", "c", "S", "if c == \"g\":\n if g_count > 0:\n g_count-=1\n ans += 1\n else:\n g_count += 1\n else:\n if g_count > 0:\n g_count-=1\n\n else:\n g_count += 1\n ans -=1", "c == \"g\"", "c", "\"g\"", "if g_count > 0:\n g_count-=1\n ans += 1\n else:\n g_count += 1\n ", "g_count > 0", "g_count", "0", "g_count-=1", "g_count", "1", "ans += 1", "ans", "1", "g_count += 1", "g_count", "1", "if g_count > 0:\n g_count-=1\n\n else:\n g_count += 1\n ans -=1", "g_count > 0", "g_count", "0", "g_count-=1", "g_count", "1", "g_count += 1", "g_count", "1", "ans -=1", "ans", "1", "print(ans)", "print", "ans", "ans -=1", "1", "ans", "g_count += 1", "1", "g_count", "g_count-=1", "1", "g_count", "ans = 0", "0", "ans", "g_count = 0", "0", "g_count", "g_count += 1", "1", "g_count", "S = input()", "input()", "S", "ans += 1", "1", "ans", "g_count-=1", "1", "g_count" ]
S = input() ans = 0 g_count = 0 for c in S: if c == "g": if g_count > 0: g_count-=1 ans += 1 else: g_count += 1 else: if g_count > 0: g_count-=1 else: g_count += 1 ans -=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 14, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 53, 2 ], [ 80, 6 ], [ 54, 9 ], [ 62, 11 ], [ 56, 14 ], [ 18, 17 ], [ 81, 20 ], [ 54, 24 ], [ 17, 25 ], [ 77, 30 ], [ 65, 33 ], [ 74, 36 ], [ 71, 41 ], [ 68, 44 ], [ 59, 47 ], [ 69, 51 ], [ 78, 51 ], [ 57, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ] ]
[ "s = input()\nn = len(s)\nrem = 0\nans = 0\n\nfor i in range(n):\n if s[i]==\"g\":\n if rem:\n ans +=1\n rem -=1\n else:\n rem +=1\n else:\n if rem:\n rem -=1\n else:\n ans -=1\n rem +=1\nprint(ans)", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "rem = 0", "rem", "0", "ans = 0", "ans", "0", "for i in range(n):\n if s[i]==\"g\":\n if rem:\n ans +=1\n rem -=1\n else:\n rem +=1\n else:\n if rem:\n rem -=1\n else:\n ans -=1\n rem +=1", "i", "range(n)", "range", "n", "if s[i]==\"g\":\n if rem:\n ans +=1\n rem -=1\n else:\n rem +=1\n else:\n if rem:\n rem -=1\n else:\n ans -=1\n rem +=1", "s[i]==\"g\"", "s[i]", "s", "i", "\"g\"", "if rem:\n ans +=1\n rem -=1\n else:\n rem +=1\n ", "rem", "ans +=1", "ans", "1", "rem -=1", "rem", "1", "rem +=1", "rem", "1", "if rem:\n rem -=1\n else:\n ans -=1\n rem +=1", "rem", "rem -=1", "rem", "1", "ans -=1", "ans", "1", "rem +=1", "rem", "1", "print(ans)", "print", "ans", "s = input()", "input()", "s", "ans = 0", "0", "ans", "rem +=1", "1", "rem", "rem = 0", "0", "rem", "rem -=1", "1", "rem", "ans -=1", "1", "ans", "rem -=1", "1", "rem", "rem +=1", "1", "rem", "ans +=1", "1", "ans", "n = len(s)", "len(s)", "n" ]
s = input() n = len(s) rem = 0 ans = 0 for i in range(n): if s[i]=="g": if rem: ans +=1 rem -=1 else: rem +=1 else: if rem: rem -=1 else: ans -=1 rem +=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 2, 4, 13, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 26, 2 ], [ 29, 6 ], [ 27, 10 ], [ 14, 13 ], [ 27, 13 ], [ 13, 17 ], [ 32, 20 ], [ 33, 24 ], [ 30, 24 ], [ 26, 27 ], [ 29, 30 ], [ 32, 33 ] ]
[ "s = input()\nans = len(s) // 2\nfor i in s:\n if i == 'p':\n ans -= 1\nprint(ans)", "s = input()", "s", "input()", "input", "ans = len(s) // 2", "ans", "len(s) // 2", "len(s)", "len", "s", "2", "for i in s:\n if i == 'p':\n ans -= 1", "i", "s", "if i == 'p':\n ans -= 1", "i == 'p'", "i", "'p'", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "s = input()", "input()", "s", "ans = len(s) // 2", "len(s) // 2", "ans", "ans -= 1", "1", "ans" ]
s = input() ans = len(s) // 2 for i in s: if i == 'p': ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 13, 17, 4, 13, 2, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 25, 2 ], [ 28, 6 ], [ 26, 9 ], [ 31, 11 ], [ 29, 13 ], [ 32, 18 ], [ 26, 21 ], [ 25, 26 ], [ 28, 29 ], [ 31, 32 ] ]
[ "S = input()\nN = len(S)\n\nP = N // 2\n\nprint(P - S.count('p'))", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "P = N // 2", "P", "N // 2", "N", "2", "print(P - S.count('p'))", "print", "P - S.count('p')", "P", "S.count('p')", "S.count", "S", "count", "'p'", "S = input()", "input()", "S", "N = len(S)", "len(S)", "N", "P = N // 2", "N // 2", "P" ]
S = input() N = len(S) P = N // 2 print(P - S.count('p'))
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 51, 2 ], [ 57, 6 ], [ 78, 9 ], [ 75, 12 ], [ 16, 15 ], [ 52, 15 ], [ 15, 19 ], [ 58, 23 ], [ 73, 23 ], [ 55, 23 ], [ 79, 24 ], [ 61, 24 ], [ 67, 24 ], [ 66, 26 ], [ 69, 29 ], [ 54, 32 ], [ 58, 36 ], [ 73, 36 ], [ 55, 36 ], [ 79, 37 ], [ 61, 37 ], [ 67, 37 ], [ 60, 39 ], [ 72, 42 ], [ 63, 45 ], [ 64, 49 ], [ 70, 49 ], [ 76, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ] ]
[ "S = input()\ng = 0\np = 0\nans = 0\nfor s in S:\n if s==\"g\":\n if g>p:\n p+=1\n ans+=1\n else:\n g+=1\n else:\n if g>p:\n p+=1\n else:\n g+=1\n ans-=1\nprint(ans)", "S = input()", "S", "input()", "input", "g = 0", "g", "0", "p = 0", "p", "0", "ans = 0", "ans", "0", "for s in S:\n if s==\"g\":\n if g>p:\n p+=1\n ans+=1\n else:\n g+=1\n else:\n if g>p:\n p+=1\n else:\n g+=1\n ans-=1", "s", "S", "if s==\"g\":\n if g>p:\n p+=1\n ans+=1\n else:\n g+=1\n else:\n if g>p:\n p+=1\n else:\n g+=1\n ans-=1", "s==\"g\"", "s", "\"g\"", "if g>p:\n p+=1\n ans+=1\n else:\n g+=1\n ", "g>p", "g", "p", "p+=1", "p", "1", "ans+=1", "ans", "1", "g+=1", "g", "1", "if g>p:\n p+=1\n else:\n g+=1\n ans-=1", "g>p", "g", "p", "p+=1", "p", "1", "g+=1", "g", "1", "ans-=1", "ans", "1", "print(ans)", "print", "ans", "S = input()", "input()", "S", "g+=1", "1", "g", "g = 0", "0", "g", "p+=1", "1", "p", "ans-=1", "1", "ans", "p+=1", "1", "p", "ans+=1", "1", "ans", "g+=1", "1", "g", "ans = 0", "0", "ans", "p = 0", "0", "p" ]
S = input() g = 0 p = 0 ans = 0 for s in S: if s=="g": if g>p: p+=1 ans+=1 else: g+=1 else: if g>p: p+=1 else: g+=1 ans-=1 print(ans)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 2, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 35, 2 ], [ 29, 8 ], [ 36, 11 ], [ 32, 15 ], [ 36, 18 ], [ 30, 25 ], [ 33, 26 ], [ 29, 30 ], [ 32, 33 ], [ 35, 36 ] ]
[ "s = str(input())\ng = s.count(\"g\")\np = s.count(\"p\")\nprint((g-p)//2)", "s = str(input())", "s", "str(input())", "str", "input()", "input", "g = s.count(\"g\")", "g", "s.count(\"g\")", "s.count", "s", "count", "\"g\"", "p = s.count(\"p\")", "p", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "print((g-p)//2)", "print", "(g-p)//2", "g-p", "g", "p", "2", "g = s.count(\"g\")", "s.count(\"g\")", "g", "p = s.count(\"p\")", "s.count(\"p\")", "p", "s = str(input())", "str(input())", "s" ]
s = str(input()) g = s.count("g") p = s.count("p") print((g-p)//2)
[ 7, 0, 13, 4, 18, 4, 13, 13, 4, 13, 2, 2, 4, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 22, 2 ], [ 23, 14 ], [ 23, 18 ], [ 22, 23 ] ]
[ "s = input().rstrip()\nprint(len(s)//2-s.count(\"p\"))", "s = input().rstrip()", "s", "input().rstrip()", "().rstrip", "()", "input", "rstrip", "print(len(s)//2-s.count(\"p\"))", "print", "len(s)//2-s.count(\"p\")", "len(s)//2", "len(s)", "len", "s", "2", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "s = input().rstrip()", "input().rstrip()", "s" ]
s = input().rstrip() print(len(s)//2-s.count("p"))
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 67, 2 ], [ 70, 6 ], [ 61, 9 ], [ 91, 12 ], [ 16, 15 ], [ 68, 15 ], [ 15, 19 ], [ 73, 22 ], [ 71, 26 ], [ 95, 26 ], [ 83, 26 ], [ 89, 26 ], [ 80, 26 ], [ 79, 29 ], [ 64, 32 ], [ 88, 35 ], [ 15, 39 ], [ 76, 42 ], [ 71, 46 ], [ 95, 46 ], [ 83, 46 ], [ 89, 46 ], [ 80, 46 ], [ 82, 49 ], [ 94, 52 ], [ 85, 55 ], [ 86, 59 ], [ 65, 59 ], [ 92, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ] ]
[ "s = input()\nat = 0\nto = 0\nres = 0\n\nfor i in s:\n if i == \"g\":\n to += 1\n if at > 0:\n at -= 1\n res += 1\n else:\n at += 1\n elif i == \"p\":\n to -= 1\n if at > 0:\n at -= 1\n else:\n at += 1\n res -= 1\nelse:\n print(res)", "s = input()", "s", "input()", "input", "at = 0", "at", "0", "to = 0", "to", "0", "res = 0", "res", "0", "for i in s:\n if i == \"g\":\n to += 1\n if at > 0:\n at -= 1\n res += 1\n else:\n at += 1\n elif i == \"p\":\n to -= 1\n if at > 0:\n at -= 1\n else:\n at += 1\n res -= 1\nelse:\n print(res)", "i", "s", "if i == \"g\":\n to += 1\n if at > 0:\n at -= 1\n res += 1\n else:\n at += 1\n elif i == \"p\":\n to -= 1\n if at > 0:\n at -= 1\n else:\n at += 1\n res -= 1", "i == \"g\"", "i", "\"g\"", "to += 1", "to", "1", "if at > 0:\n at -= 1\n res += 1\n else:\n at += 1\n ", "at > 0", "at", "0", "at -= 1", "at", "1", "res += 1", "res", "1", "at += 1", "at", "1", "elif i == \"p\":\n to -= 1\n if at > 0:\n at -= 1\n else:\n at += 1\n res -= 1", "i == \"p\"", "i", "\"p\"", "to -= 1", "to", "1", "if at > 0:\n at -= 1\n else:\n at += 1\n res -= 1", "at > 0", "at", "0", "at -= 1", "at", "1", "at += 1", "at", "1", "res -= 1", "res", "1", "print(res)", "print", "res", "to = 0", "0", "to", "res += 1", "1", "res", "s = input()", "input()", "s", "at = 0", "0", "at", "to += 1", "1", "to", "to -= 1", "1", "to", "at -= 1", "1", "at", "at -= 1", "1", "at", "res -= 1", "1", "res", "at += 1", "1", "at", "res = 0", "0", "res", "at += 1", "1", "at" ]
s = input() at = 0 to = 0 res = 0 for i in s: if i == "g": to += 1 if at > 0: at -= 1 res += 1 else: at += 1 elif i == "p": to -= 1 if at > 0: at -= 1 else: at += 1 res -= 1 else: print(res)
[ 7, 0, 13, 4, 13, 4, 13, 2, 4, 13, 4, 13, 4, 13, 12, 2, 13, 17, 23, 18, 13, 39, 17, 17, 4, 13, 4, 13, 4, 13, 12, 2, 13, 17, 23, 18, 13, 39, 17, 17, 10, 4, 13 ]
[ [ 41, 2 ], [ 42, 20 ], [ 42, 36 ], [ 41, 42 ] ]
[ "s = input()\nprint(len(list(filter(lambda x: x == 'g',\n s[1::2]))) - len(list(filter(lambda x: x == 'p', s[0::2]))))", "s = input()", "s", "input()", "input", "print(len(list(filter(lambda x: x == 'g',\n s[1::2]))) - len(list(filter(lambda x: x == 'p', s[0::2]))))", "print", "len(list(filter(lambda x: x == 'g',\n s[1::2]))) - len(list(filter(lambda x: x == 'p', s[0::2])))", "len(list(filter(lambda x: x == 'g',\n s[1::2])))", "len", "list(filter(lambda x: x == 'g',\n s[1::2]))", "list", "filter(lambda x: x == 'g',\n s[1::2])", "filter", "lambda x: x == 'g'", "x == 'g'", "x", "'g'", "x", "s[1::2]", "s", "1::2", "1", "2", "len(list(filter(lambda x: x == 'p', s[0::2])))", "len", "list(filter(lambda x: x == 'p', s[0::2]))", "list", "filter(lambda x: x == 'p', s[0::2])", "filter", "lambda x: x == 'p'", "x == 'p'", "x", "'p'", "x", "s[0::2]", "s", "0::2", "0", "2", "s = input()", "input()", "s" ]
s = input() print(len(list(filter(lambda x: x == 'g', s[1::2]))) - len(list(filter(lambda x: x == 'p', s[0::2]))))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 2, 13, 17, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 48, 2 ], [ 54, 8 ], [ 12, 11 ], [ 49, 16 ], [ 11, 20 ], [ 49, 26 ], [ 11, 27 ], [ 51, 30 ], [ 49, 35 ], [ 11, 36 ], [ 45, 39 ], [ 46, 43 ], [ 52, 43 ], [ 55, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ] ]
[ "s=list(input())\nres = 0\nfor i in range(len(s)):\n if i%2 == 0:\n if s[i] == 'p':\n res-=1\n else:\n if s[i]=='g':\n res += 1\nprint(res)", "s=list(input())", "s", "list(input())", "list", "input()", "input", "res = 0", "res", "0", "for i in range(len(s)):\n if i%2 == 0:\n if s[i] == 'p':\n res-=1\n else:\n if s[i]=='g':\n res += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if i%2 == 0:\n if s[i] == 'p':\n res-=1\n else:\n if s[i]=='g':\n res += 1", "i%2 == 0", "i%2", "i", "2", "0", "if s[i] == 'p':\n res-=1\n ", "s[i] == 'p'", "s[i]", "s", "i", "'p'", "res-=1", "res", "1", "if s[i]=='g':\n res += 1", "s[i]=='g'", "s[i]", "s", "i", "'g'", "res += 1", "res", "1", "print(res)", "print", "res", "res += 1", "1", "res", "s=list(input())", "list(input())", "s", "res-=1", "1", "res", "res = 0", "0", "res" ]
s=list(input()) res = 0 for i in range(len(s)): if i%2 == 0: if s[i] == 'p': res-=1 else: if s[i]=='g': res += 1 print(res)
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 13, 13, 14, 2, 2, 13, 13, 17, 4, 13, 17, 4, 13, 4, 13, 2, 13, 2, 13, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 43, 2 ], [ 46, 6 ], [ 44, 9 ], [ 52, 13 ], [ 44, 16 ], [ 49, 20 ], [ 44, 23 ], [ 47, 27 ], [ 53, 28 ], [ 53, 38 ], [ 50, 40 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ] ]
[ "s=input()\ng=s.count(\"g\")\np=s.count(\"p\")\nlength=len(s)\nif g-p<2:\n print(0)\nelse:\n print(abs(p - length//2 ))", "s=input()", "s", "input()", "input", "g=s.count(\"g\")", "g", "s.count(\"g\")", "s.count", "s", "count", "\"g\"", "p=s.count(\"p\")", "p", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "length=len(s)", "length", "len(s)", "len", "s", "if g-p<2:\n print(0)\nelse:\n print(abs(p - length//2 ))", "g-p<2", "g-p", "g", "p", "2", "print(0)", "print", "0", "print(abs(p - length//2 ))", "print", "abs(p - length//2 )", "abs", "p - length//2", "p", "length//2", "length", "2", "s=input()", "input()", "s", "g=s.count(\"g\")", "s.count(\"g\")", "g", "length=len(s)", "len(s)", "length", "p=s.count(\"p\")", "s.count(\"p\")", "p" ]
s=input() g=s.count("g") p=s.count("p") length=len(s) if g-p<2: print(0) else: print(abs(p - length//2 ))
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 13, 13, 0, 13, 17, 14, 2, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 59, 2 ], [ 80, 6 ], [ 60, 9 ], [ 65, 11 ], [ 68, 14 ], [ 77, 17 ], [ 21, 20 ], [ 81, 23 ], [ 69, 26 ], [ 63, 26 ], [ 78, 27 ], [ 72, 27 ], [ 57, 27 ], [ 62, 29 ], [ 60, 34 ], [ 20, 35 ], [ 60, 40 ], [ 20, 41 ], [ 56, 44 ], [ 71, 47 ], [ 74, 50 ], [ 75, 54 ], [ 66, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ] ]
[ "s=input()\nn=len(s)\n\nans=0\n\ng=0 ; p=0\nfor i in range(n):\n if g==p:\n g+=1\n if s[i]==\"p\": ans-=1\n else:\n if s[i]==\"p\":\n p+=1 \n else:\n p+=1\n ans+=1\nprint(ans)", "s=input()", "s", "input()", "input", "n=len(s)", "n", "len(s)", "len", "s", "ans=0", "ans", "0", "g=0", "g", "0", "p=0", "p", "0", "for i in range(n):\n if g==p:\n g+=1\n if s[i]==\"p\": ans-=1\n else:\n if s[i]==\"p\":\n p+=1 \n else:\n p+=1\n ans+=1", "i", "range(n)", "range", "n", "if g==p:\n g+=1\n if s[i]==\"p\": ans-=1\n else:\n if s[i]==\"p\":\n p+=1 \n else:\n p+=1\n ans+=1", "g==p", "g", "p", "g+=1", "g", "1", "if s[i]==\"p\": ans-=1\n ", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "if s[i]==\"p\":\n p+=1 \n else:\n p+=1\n ans+=1", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "p+=1", "p", "1", "p+=1", "p", "1", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "p+=1", "1", "p", "s=input()", "input()", "s", "g+=1", "1", "g", "ans=0", "0", "ans", "g=0", "0", "g", "p+=1", "1", "p", "ans+=1", "1", "ans", "p=0", "0", "p", "n=len(s)", "len(s)", "n" ]
s=input() n=len(s) ans=0 g=0 ; p=0 for i in range(n): if g==p: g+=1 if s[i]=="p": ans-=1 else: if s[i]=="p": p+=1 else: p+=1 ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 2, 18, 13, 13, 17, 0, 13, 2, 18, 13, 13, 17, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 46, 2 ], [ 43, 6 ], [ 10, 9 ], [ 47, 14 ], [ 9, 17 ], [ 37, 20 ], [ 47, 23 ], [ 9, 24 ], [ 40, 27 ], [ 47, 30 ], [ 9, 31 ], [ 41, 35 ], [ 38, 35 ], [ 44, 35 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ] ]
[ "s=input()\nc=0\nfor i in range(len(s)):\n if i%2:\n c+=(s[i]=='g')\n else:\n c-=(s[i]=='p')\nprint(c)", "s=input()", "s", "input()", "input", "c=0", "c", "0", "for i in range(len(s)):\n if i%2:\n c+=(s[i]=='g')\n else:\n c-=(s[i]=='p')", "i", "range(len(s))", "range", "len(s)", "len", "s", "if i%2:\n c+=(s[i]=='g')\n else:\n c-=(s[i]=='p')", "i%2", "i", "2", "c+=(s[i]=='g')", "c", "s[i]=='g'", "s[i]", "s", "i", "'g'", "c-=(s[i]=='p')", "c", "s[i]=='p'", "s[i]", "s", "i", "'p'", "print(c)", "print", "c", "c+=(s[i]=='g')", "s[i]=='g'", "c", "c-=(s[i]=='p')", "s[i]=='p'", "c", "c=0", "0", "c", "s=input()", "input()", "s" ]
s=input() c=0 for i in range(len(s)): if i%2: c+=(s[i]=='g') else: c-=(s[i]=='p') print(c)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 13, 13, 14, 2, 2, 13, 17, 17, 4, 13, 2, 4, 13, 2, 13, 17, 13, 4, 13, 2, 4, 13, 2, 2, 13, 17, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 59, 2 ], [ 56, 8 ], [ 60, 11 ], [ 53, 15 ], [ 60, 18 ], [ 62, 22 ], [ 60, 25 ], [ 63, 29 ], [ 63, 38 ], [ 54, 40 ], [ 63, 48 ], [ 54, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ] ]
[ "S = list(input())\ng = S.count(\"g\")\np = S.count(\"p\")\n\ns = len(S)\n\nif s % 2 == 0:\n\tprint(int(s // 2) - p)\nelse:\n\tprint(int((s - 1) // 2) - p)", "S = list(input())", "S", "list(input())", "list", "input()", "input", "g = S.count(\"g\")", "g", "S.count(\"g\")", "S.count", "S", "count", "\"g\"", "p = S.count(\"p\")", "p", "S.count(\"p\")", "S.count", "S", "count", "\"p\"", "s = len(S)", "s", "len(S)", "len", "S", "if s % 2 == 0:\n\tprint(int(s // 2) - p)\nelse:\n\tprint(int((s - 1) // 2) - p)", "s % 2 == 0", "s % 2", "s", "2", "0", "print(int(s // 2) - p)", "print", "int(s // 2) - p", "int(s // 2)", "int", "s // 2", "s", "2", "p", "print(int((s - 1) // 2) - p)", "print", "int((s - 1) // 2) - p", "int((s - 1) // 2)", "int", "(s - 1) // 2", "s - 1", "s", "1", "2", "p", "p = S.count(\"p\")", "S.count(\"p\")", "p", "g = S.count(\"g\")", "S.count(\"g\")", "g", "S = list(input())", "list(input())", "S", "s = len(S)", "len(S)", "s" ]
S = list(input()) g = S.count("g") p = S.count("p") s = len(S) if s % 2 == 0: print(int(s // 2) - p) else: print(int((s - 1) // 2) - p)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 66, 2 ], [ 54, 6 ], [ 57, 9 ], [ 60, 12 ], [ 16, 15 ], [ 67, 15 ], [ 58, 19 ], [ 46, 19 ], [ 55, 20 ], [ 49, 20 ], [ 45, 22 ], [ 15, 26 ], [ 51, 29 ], [ 48, 32 ], [ 15, 36 ], [ 63, 39 ], [ 64, 43 ], [ 52, 43 ], [ 61, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ] ]
[ "s = input()\ngcnt = 0\npcnt = 0\nres = 0\n\nfor c in s:\n if pcnt<gcnt:\n pcnt += 1\n if c==\"g\":\n res += 1\n else:\n gcnt += 1\n if c==\"p\":\n res -= 1\nprint(res)", "s = input()", "s", "input()", "input", "gcnt = 0", "gcnt", "0", "pcnt = 0", "pcnt", "0", "res = 0", "res", "0", "for c in s:\n if pcnt<gcnt:\n pcnt += 1\n if c==\"g\":\n res += 1\n else:\n gcnt += 1\n if c==\"p\":\n res -= 1", "c", "s", "if pcnt<gcnt:\n pcnt += 1\n if c==\"g\":\n res += 1\n else:\n gcnt += 1\n if c==\"p\":\n res -= 1", "pcnt<gcnt", "pcnt", "gcnt", "pcnt += 1", "pcnt", "1", "if c==\"g\":\n res += 1\n ", "c==\"g\"", "c", "\"g\"", "res += 1", "res", "1", "gcnt += 1", "gcnt", "1", "if c==\"p\":\n res -= 1", "c==\"p\"", "c", "\"p\"", "res -= 1", "res", "1", "print(res)", "print", "res", "pcnt += 1", "1", "pcnt", "gcnt += 1", "1", "gcnt", "res += 1", "1", "res", "gcnt = 0", "0", "gcnt", "pcnt = 0", "0", "pcnt", "res = 0", "0", "res", "res -= 1", "1", "res", "s = input()", "input()", "s" ]
s = input() gcnt = 0 pcnt = 0 res = 0 for c in s: if pcnt<gcnt: pcnt += 1 if c=="g": res += 1 else: gcnt += 1 if c=="p": res -= 1 print(res)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 2, 2, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13, 10, 4, 13 ]
[ [ 25, 2 ], [ 22, 6 ], [ 26, 9 ], [ 23, 14 ], [ 26, 18 ], [ 22, 23 ], [ 25, 26 ] ]
[ "s = input()\n\nN = len(s)\nprint(N // 2 - s.count('p'))", "s = input()", "s", "input()", "input", "N = len(s)", "N", "len(s)", "len", "s", "print(N // 2 - s.count('p'))", "print", "N // 2 - s.count('p')", "N // 2", "N", "2", "s.count('p')", "s.count", "s", "count", "'p'", "N = len(s)", "len(s)", "N", "s = input()", "input()", "s" ]
s = input() N = len(s) print(N // 2 - s.count('p'))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 2, 39, 17, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 13, 4, 13, 2, 18, 13, 17, 17, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 50, 2 ], [ 59, 8 ], [ 51, 14 ], [ 56, 16 ], [ 20, 19 ], [ 51, 24 ], [ 51, 28 ], [ 19, 29 ], [ 53, 32 ], [ 62, 35 ], [ 41, 38 ], [ 60, 39 ], [ 19, 40 ], [ 63, 41 ], [ 54, 41 ], [ 57, 41 ], [ 60, 46 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ] ]
[ "s = list(input())\ny = [0] * (len(s))\ncnt = 0\nfor i in range(len(s)):\n if s[i] == 'g':\n cnt += 1\n else:\n cnt -= 1\n\n y[i] = cnt\n\nprint(y[-1] // 2)", "s = list(input())", "s", "list(input())", "list", "input()", "input", "y = [0] * (len(s))", "y", "[0] * (len(s))", "[0]", "0", "len(s)", "len", "s", "cnt = 0", "cnt", "0", "for i in range(len(s)):\n if s[i] == 'g':\n cnt += 1\n else:\n cnt -= 1\n\n y[i] = cnt", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == 'g':\n cnt += 1\n else:\n cnt -= 1\n\n ", "s[i] == 'g'", "s[i]", "s", "i", "'g'", "cnt += 1", "cnt", "1", "cnt -= 1", "cnt", "1", "y[i] = cnt", "y[i]", "y", "i", "cnt", "print(y[-1] // 2)", "print", "y[-1] // 2", "y[-1]", "y", "-1", "2", "s = list(input())", "list(input())", "s", "cnt += 1", "1", "cnt", "cnt = 0", "0", "cnt", "y = [0] * (len(s))", "[0] * (len(s))", "y", "cnt -= 1", "1", "cnt" ]
s = list(input()) y = [0] * (len(s)) cnt = 0 for i in range(len(s)): if s[i] == 'g': cnt += 1 else: cnt -= 1 y[i] = cnt print(y[-1] // 2)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 0, 13, 2, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 39, 2 ], [ 45, 8 ], [ 12, 11 ], [ 40, 16 ], [ 36, 18 ], [ 11, 20 ], [ 24, 23 ], [ 40, 23 ], [ 23, 27 ], [ 42, 30 ], [ 43, 34 ], [ 37, 34 ], [ 46, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ] ]
[ "s = list(input())\n\nans = 0\n\nfor i in range(len(s)):\n ans += i & 1\n\nfor c in s:\n if c == 'p':\n ans -= 1\n\nprint(ans)", "s = list(input())", "s", "list(input())", "list", "input()", "input", "ans = 0", "ans", "0", "for i in range(len(s)):\n ans += i & 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "ans += i & 1", "ans", "i & 1", "i", "1", "for c in s:\n if c == 'p':\n ans -= 1", "c", "s", "if c == 'p':\n ans -= 1", "c == 'p'", "c", "'p'", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "ans += i & 1", "i & 1", "ans", "s = list(input())", "list(input())", "s", "ans -= 1", "1", "ans", "ans = 0", "0", "ans" ]
s = list(input()) ans = 0 for i in range(len(s)): ans += i & 1 for c in s: if c == 'p': ans -= 1 print(ans)
[ 7, 15, 13, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 17, 0, 13, 2, 2, 17, 17, 17, 12, 13, 29, 4, 18, 4, 18, 18, 13, 13, 13, 13, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 78, 12 ], [ 75, 17 ], [ 39, 38 ], [ 70, 42 ], [ 45, 44 ], [ 38, 47 ], [ 50, 49 ], [ 44, 53 ], [ 44, 56 ], [ 49, 61 ], [ 73, 67 ], [ 75, 76 ], [ 78, 79 ] ]
[ "import sys\nfrom collections import Counter\n\nsys.setrecursionlimit(10 ** 6)\nINF = float(\"inf\")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n S = list(input())\n c = Counter(S)\n ans = (c[\"g\"] - c[\"p\"]) // 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "from collections import Counter", "sys.setrecursionlimit(10 ** 6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 6", "10", "6", "INF = float(\"inf\")", "INF", "float(\"inf\")", "float", "\"inf\"", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "def input():\n return sys.stdin.readline().strip()", "input", "return sys.stdin.readline().strip()", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "def main():\n S = list(input())\n c = Counter(S)\n ans = (c[\"g\"] - c[\"p\"]) // 2\n print(ans)", "main", "S = list(input())", "S", "list(input())", "list", "input()", "input", "c = Counter(S)", "c", "Counter(S)", "Counter", "S", "ans = (c[\"g\"] - c[\"p\"]) // 2", "ans", "(c[\"g\"] - c[\"p\"]) // 2", "c[\"g\"] - c[\"p\"]", "c[\"g\"]", "c", "\"g\"", "c[\"p\"]", "c", "\"p\"", "2", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def input():\n return sys.stdin.readline().strip()", "def input():\n return sys.stdin.readline().strip()", "input", "def main():\n S = list(input())\n c = Counter(S)\n ans = (c[\"g\"] - c[\"p\"]) // 2\n print(ans)", "def main():\n S = list(input())\n c = Counter(S)\n ans = (c[\"g\"] - c[\"p\"]) // 2\n print(ans)", "main", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "INF = float(\"inf\")", "float(\"inf\")", "INF" ]
import sys from collections import Counter sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() def main(): S = list(input()) c = Counter(S) ans = (c["g"] - c["p"]) // 2 print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 2, 2, 13, 13, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 29, 2 ], [ 32, 6 ], [ 30, 9 ], [ 35, 13 ], [ 30, 16 ], [ 33, 24 ], [ 36, 25 ], [ 36, 27 ], [ 29, 30 ], [ 32, 33 ], [ 35, 36 ] ]
[ "s=input()\n\nng = s.count('g')\nnp = s.count('p')\n\nprint((ng+np)//2 - np)", "s=input()", "s", "input()", "input", "ng = s.count('g')", "ng", "s.count('g')", "s.count", "s", "count", "'g'", "np = s.count('p')", "np", "s.count('p')", "s.count", "s", "count", "'p'", "print((ng+np)//2 - np)", "print", "(ng+np)//2 - np", "(ng+np)//2", "ng+np", "ng", "np", "2", "np", "s=input()", "input()", "s", "ng = s.count('g')", "s.count('g')", "ng", "np = s.count('p')", "s.count('p')", "np" ]
s=input() ng = s.count('g') np = s.count('p') print((ng+np)//2 - np)
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 12, 13, 0, 13, 4, 18, 4, 13, 13, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 2, 4, 13, 13, 17, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 18, 13 ]
[ [ 45, 4 ], [ 14, 13 ], [ 46, 17 ], [ 21, 20 ], [ 13, 23 ], [ 13, 32 ], [ 20, 34 ], [ 43, 40 ], [ 45, 46 ] ]
[ "import sys\ninput = sys.stdin.readline\n\ndef main():\n s= input().strip()\n p = s.count(\"p\")\n print((len(s)//2) - p)\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "def main():\n s= input().strip()\n p = s.count(\"p\")\n print((len(s)//2) - p)", "main", "s= input().strip()", "s", "input().strip()", "().strip", "()", "input", "strip", "p = s.count(\"p\")", "p", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "print((len(s)//2) - p)", "print", "(len(s)//2) - p", "len(s)//2", "len(s)", "len", "s", "2", "p", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n s= input().strip()\n p = s.count(\"p\")\n print((len(s)//2) - p)", "def main():\n s= input().strip()\n p = s.count(\"p\")\n print((len(s)//2) - p)", "main", "input = sys.stdin.readline", "sys.stdin.readline", "input" ]
import sys input = sys.stdin.readline def main(): s= input().strip() p = s.count("p") print((len(s)//2) - p) if __name__ == "__main__": main()
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 18, 18, 13, 13, 13, 15, 4, 18, 13, 13, 2, 17, 17, 15, 13, 0, 13, 2, 17, 17, 0, 13, 17, 0, 13, 17, 12, 13, 29, 4, 13, 4, 13, 12, 13, 29, 4, 13, 13, 4, 18, 4, 13, 13, 23, 13, 13, 12, 13, 29, 4, 13, 13, 4, 18, 4, 13, 13, 23, 13, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 18, 13, 10, 17, 13, 10, 2, 13, 10, 12, 13, 10, 18, 13, 10, 17, 13, 10, 18, 13, 10, 18, 13, 10, 12, 13 ]
[ [ 177, 4 ], [ 180, 13 ], [ 171, 22 ], [ 159, 29 ], [ 165, 46 ], [ 162, 51 ], [ 174, 54 ], [ 178, 62 ], [ 75, 68 ], [ 178, 72 ], [ 76, 75 ], [ 89, 82 ], [ 181, 86 ], [ 90, 89 ], [ 95, 94 ], [ 99, 98 ], [ 102, 101 ], [ 105, 104 ], [ 108, 107 ], [ 94, 107 ], [ 107, 111 ], [ 98, 115 ], [ 138, 115 ], [ 124, 115 ], [ 101, 116 ], [ 135, 116 ], [ 121, 116 ], [ 119, 118 ], [ 122, 121 ], [ 125, 124 ], [ 107, 128 ], [ 124, 132 ], [ 98, 132 ], [ 138, 132 ], [ 121, 133 ], [ 101, 133 ], [ 135, 133 ], [ 136, 135 ], [ 139, 138 ], [ 142, 141 ], [ 141, 145 ], [ 118, 145 ], [ 104, 145 ], [ 157, 151 ], [ 159, 160 ], [ 162, 163 ], [ 165, 166 ], [ 171, 172 ], [ 174, 175 ], [ 177, 178 ], [ 180, 181 ] ]
[ "# coding: utf-8\nimport sys\n\n# from operator import itemgetter\nsysread = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nprintout = sys.stdout.write\nsprint = sys.stdout.flush\n# from heapq import heappop, heappush\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\nimport math\n# from itertools import product, accumulate, combinations, product\n#import bisect\n# import numpy as np\n# from copy import deepcopy\n#from collections import deque\n# from decimal import Decimal\n# from numba import jit\n\nINF = 1 << 50\nEPS = 1e-8\nmod = 998244353\n\n\ndef intread():\n return int(sysread())\ndef mapline(t=int):\n return map(t, sysread().split())\ndef mapread(t=int):\n return map(t, read().split())\n\n\n\ndef run():\n S = input()\n G = 0\n P = 0\n score = 0\n for s in S:\n if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n print(score)\n\nif __name__ == \"__main__\":\n #print(math.gcd(0, 10))\n run()", "import sys", "sys", "sysread = sys.stdin.buffer.readline", "sysread", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "read = sys.stdin.buffer.read", "read", "sys.stdin.buffer.read", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "read", "printout = sys.stdout.write", "printout", "sys.stdout.write", "sys.stdout", "sys", "stdout", "write", "sprint = sys.stdout.flush", "sprint", "sys.stdout.flush", "sys.stdout", "sys", "stdout", "flush", "from collections import defaultdict", "sys.setrecursionlimit(10 ** 7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 7", "10", "7", "import math", "math", "INF = 1 << 50", "INF", "1 << 50", "1", "50", "EPS = 1e-8", "EPS", "1e-8", "mod = 998244353", "mod", "998244353", "def intread():\n return int(sysread())", "intread", "return int(sysread())", "int(sysread())", "int", "sysread()", "sysread", "def mapline(t=int):\n return map(t, sysread().split())", "mapline", "return map(t, sysread().split())", "map(t, sysread().split())", "map", "t", "sysread().split()", "().split", "()", "sysread", "split", "t=int", "t", "int", "def mapread(t=int):\n return map(t, read().split())", "mapread", "return map(t, read().split())", "map(t, read().split())", "map", "t", "read().split()", "().split", "()", "read", "split", "t=int", "t", "int", "def run():\n S = input()\n G = 0\n P = 0\n score = 0\n for s in S:\n if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n print(score)", "run", "S = input()", "S", "input()", "input", "G = 0", "G", "0", "P = 0", "P", "0", "score = 0", "score", "0", "for s in S:\n if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n ", "s", "S", "if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n ", "s == 'g'", "s", "'g'", "if G > P:\n score += 1\n P += 1\n else:\n G += 1\n ", "G > P", "G", "P", "score += 1", "score", "1", "P += 1", "P", "1", "G += 1", "G", "1", "if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n ", "s == 'p'", "s", "'p'", "if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n ", "G > P", "G", "P", "P += 1", "P", "1", "G += 1", "G", "1", "score -= 1", "score", "1", "print(score)", "print", "score", "if __name__ == \"__main__\":\n #print(math.gcd(0, 10))\n run()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "run()", "run", "def intread():\n return int(sysread())", "def intread():\n return int(sysread())", "intread", "def run():\n S = input()\n G = 0\n P = 0\n score = 0\n for s in S:\n if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n print(score)", "def run():\n S = input()\n G = 0\n P = 0\n score = 0\n for s in S:\n if s == 'g':\n if G > P:\n score += 1\n P += 1\n else:\n G += 1\n if s == 'p':\n if G > P:\n P += 1\n else:\n G += 1\n score -= 1\n\n print(score)", "run", "sprint = sys.stdout.flush", "sys.stdout.flush", "sprint", "EPS = 1e-8", "1e-8", "EPS", "INF = 1 << 50", "1 << 50", "INF", "def mapline(t=int):\n return map(t, sysread().split())", "def mapline(t=int):\n return map(t, sysread().split())", "mapline", "printout = sys.stdout.write", "sys.stdout.write", "printout", "mod = 998244353", "998244353", "mod", "sysread = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "sysread", "read = sys.stdin.buffer.read", "sys.stdin.buffer.read", "read", "def mapread(t=int):\n return map(t, read().split())", "def mapread(t=int):\n return map(t, read().split())", "mapread" ]
# coding: utf-8 import sys # from operator import itemgetter sysread = sys.stdin.buffer.readline read = sys.stdin.buffer.read printout = sys.stdout.write sprint = sys.stdout.flush # from heapq import heappop, heappush from collections import defaultdict sys.setrecursionlimit(10 ** 7) import math # from itertools import product, accumulate, combinations, product #import bisect # import numpy as np # from copy import deepcopy #from collections import deque # from decimal import Decimal # from numba import jit INF = 1 << 50 EPS = 1e-8 mod = 998244353 def intread(): return int(sysread()) def mapline(t=int): return map(t, sysread().split()) def mapread(t=int): return map(t, read().split()) def run(): S = input() G = 0 P = 0 score = 0 for s in S: if s == 'g': if G > P: score += 1 P += 1 else: G += 1 if s == 'p': if G > P: P += 1 else: G += 1 score -= 1 print(score) if __name__ == "__main__": #print(math.gcd(0, 10)) run()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 2, 2, 13, 13, 17, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 32, 2 ], [ 35, 6 ], [ 41, 9 ], [ 13, 12 ], [ 33, 12 ], [ 12, 16 ], [ 44, 19 ], [ 38, 22 ], [ 45, 28 ], [ 36, 28 ], [ 39, 29 ], [ 42, 29 ], [ 32, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ], [ 44, 45 ] ]
[ "s = input()\n\ng = 0\np = 0\n\nfor si in s:\n if si == 'g':\n g += 1\n else:\n p += 1\n\nprint((g-p)//2)\n", "s = input()", "s", "input()", "input", "g = 0", "g", "0", "p = 0", "p", "0", "for si in s:\n if si == 'g':\n g += 1\n else:\n p += 1", "si", "s", "if si == 'g':\n g += 1\n else:\n p += 1", "si == 'g'", "si", "'g'", "g += 1", "g", "1", "p += 1", "p", "1", "print((g-p)//2)", "print", "(g-p)//2", "g-p", "g", "p", "2", "s = input()", "input()", "s", "g = 0", "0", "g", "p += 1", "1", "p", "p = 0", "0", "p", "g += 1", "1", "g" ]
s = input() g = 0 p = 0 for si in s: if si == 'g': g += 1 else: p += 1 print((g-p)//2)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 2, 4, 13, 13, 17, 4, 13, 2, 40, 4, 18, 18, 13, 39, 2, 4, 13, 13, 13, 13, 17, 4, 18, 18, 13, 39, 2, 4, 13, 13, 13, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 12 ], [ 4, 21 ], [ 4, 26 ], [ 8, 27 ], [ 4, 33 ], [ 4, 38 ], [ 8, 39 ], [ 46, 43 ] ]
[ "def main():\n S = input()\n m = len(S) // 2\n print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g'))\n\nmain()", "def main():\n S = input()\n m = len(S) // 2\n print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g'))", "main", "S = input()", "S", "input()", "input", "m = len(S) // 2", "m", "len(S) // 2", "len(S)", "len", "S", "2", "print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g'))", "print", "-S[:len(S) - m].count('p') + S[len(S) - m:].count('g')", "-S[:len(S) - m].count('p')", "S[:len(S) - m].count('p')", "[:len(S) - m].count", "[:len(S) - m]", "S", ":len(S) - m", "len(S) - m", "len(S)", "len", "S", "m", "count", "'p'", "S[len(S) - m:].count('g')", "[len(S) - m:].count", "[len(S) - m:]", "S", "len(S) - m:", "len(S) - m", "len(S)", "len", "S", "m", "count", "'g'", "main()", "main", "def main():\n S = input()\n m = len(S) // 2\n print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g'))", "def main():\n S = input()\n m = len(S) // 2\n print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g'))", "main" ]
def main(): S = input() m = len(S) // 2 print(-S[:len(S) - m].count('p') + S[len(S) - m:].count('g')) main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 9, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 67, 2 ], [ 70, 6 ], [ 61, 9 ], [ 13, 12 ], [ 68, 12 ], [ 12, 16 ], [ 71, 20 ], [ 74, 20 ], [ 65, 20 ], [ 53, 20 ], [ 59, 20 ], [ 58, 23 ], [ 49, 26 ], [ 52, 30 ], [ 71, 34 ], [ 74, 34 ], [ 65, 34 ], [ 53, 34 ], [ 59, 34 ], [ 64, 37 ], [ 55, 40 ], [ 73, 43 ], [ 56, 47 ], [ 50, 47 ], [ 62, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ] ]
[ "S = input()\nt = 0\np = 0\nfor s in S:\n if s == \"g\":\n if t > 0: #パーを出す\n t -= 1\n p += 1\n continue\n else:\n t += 1 #グーを出す\n else:\n if t > 0: #パーを出す\n t -= 1\n else: #グーを出す\n p -= 1\n t += 1\nprint(p)", "S = input()", "S", "input()", "input", "t = 0", "t", "0", "p = 0", "p", "0", "for s in S:\n if s == \"g\":\n if t > 0: #パーを出す\n t -= 1\n p += 1\n continue\n else:\n t += 1 #グーを出す\n else:\n if t > 0: #パーを出す\n t -= 1\n else: #グーを出す\n p -= 1\n t += 1", "s", "S", "if s == \"g\":\n if t > 0: #パーを出す\n t -= 1\n p += 1\n continue\n else:\n t += 1 #グーを出す\n else:\n if t > 0: #パーを出す\n t -= 1\n else: #グーを出す\n p -= 1\n t += 1", "s == \"g\"", "s", "\"g\"", "if t > 0: #パーを出す\n t -= 1\n p += 1\n continue\n else:\n t += 1 #グーを出す\n ", "t > 0", "t", "0", "t -= 1", "t", "1", "p += 1", "p", "1", "continue", "t += 1", "t", "1", "if t > 0: #パーを出す\n t -= 1\n else: #グーを出す\n p -= 1\n t += 1", "t > 0", "t", "0", "t -= 1", "t", "1", "p -= 1", "p", "1", "t += 1", "t", "1", "print(p)", "print", "p", "p += 1", "1", "p", "t += 1", "1", "t", "p -= 1", "1", "p", "t -= 1", "1", "t", "p = 0", "0", "p", "t -= 1", "1", "t", "S = input()", "input()", "S", "t = 0", "0", "t", "t += 1", "1", "t" ]
S = input() t = 0 p = 0 for s in S: if s == "g": if t > 0: #パーを出す t -= 1 p += 1 continue else: t += 1 #グーを出す else: if t > 0: #パーを出す t -= 1 else: #グーを出す p -= 1 t += 1 print(p)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 2, 40, 13, 2, 4, 13, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 38, 2 ], [ 35, 6 ], [ 10, 9 ], [ 39, 9 ], [ 9, 13 ], [ 32, 16 ], [ 41, 19 ], [ 33, 22 ], [ 36, 22 ], [ 39, 26 ], [ 42, 30 ], [ 32, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ] ]
[ "S = input()\n\ncount = 0\nfor s in S :\n if s == 'p' :\n count += 1\n\nans = -count + len(S) // 2\nprint(ans)", "S = input()", "S", "input()", "input", "count = 0", "count", "0", "for s in S :\n if s == 'p' :\n count += 1", "s", "S", "if s == 'p' :\n count += 1", "s == 'p'", "s", "'p'", "count += 1", "count", "1", "ans = -count + len(S) // 2", "ans", "-count + len(S) // 2", "-count", "count", "len(S) // 2", "len(S)", "len", "S", "2", "print(ans)", "print", "ans", "count += 1", "1", "count", "count = 0", "0", "count", "S = input()", "input()", "S", "ans = -count + len(S) // 2", "-count + len(S) // 2", "ans" ]
S = input() count = 0 for s in S : if s == 'p' : count += 1 ans = -count + len(S) // 2 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 2, 2, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13, 10, 4, 13 ]
[ [ 25, 2 ], [ 22, 6 ], [ 26, 9 ], [ 23, 14 ], [ 26, 18 ], [ 22, 23 ], [ 25, 26 ] ]
[ "S = input()\nN = len(S)\n\nprint(N // 2 - S.count('p'))", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "print(N // 2 - S.count('p'))", "print", "N // 2 - S.count('p')", "N // 2", "N", "2", "S.count('p')", "S.count", "S", "count", "'p'", "N = len(S)", "len(S)", "N", "S = input()", "input()", "S" ]
S = input() N = len(S) print(N // 2 - S.count('p'))
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 9, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 61, 2 ], [ 55, 6 ], [ 49, 9 ], [ 13, 12 ], [ 62, 12 ], [ 56, 16 ], [ 59, 16 ], [ 44, 16 ], [ 43, 19 ], [ 12, 23 ], [ 46, 26 ], [ 12, 31 ], [ 52, 34 ], [ 58, 37 ], [ 53, 41 ], [ 47, 41 ], [ 50, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ] ]
[ "S = input()\n\nnow = 0\nans = 0\nfor s in S:\n if now == 0:\n now += 1\n if s == 'p':\n ans -= 1\n continue\n if s == 'g':\n ans += 1\n now -= 1\n\nprint(ans)", "S = input()", "S", "input()", "input", "now = 0", "now", "0", "ans = 0", "ans", "0", "for s in S:\n if now == 0:\n now += 1\n if s == 'p':\n ans -= 1\n continue\n if s == 'g':\n ans += 1\n now -= 1", "s", "S", "if now == 0:\n now += 1\n if s == 'p':\n ans -= 1\n continue\n ", "now == 0", "now", "0", "now += 1", "now", "1", "if s == 'p':\n ans -= 1\n ", "s == 'p'", "s", "'p'", "ans -= 1", "ans", "1", "continue", "if s == 'g':\n ans += 1\n ", "s == 'g'", "s", "'g'", "ans += 1", "ans", "1", "now -= 1", "now", "1", "print(ans)", "print", "ans", "now += 1", "1", "now", "ans -= 1", "1", "ans", "ans = 0", "0", "ans", "ans += 1", "1", "ans", "now = 0", "0", "now", "now -= 1", "1", "now", "S = input()", "input()", "S" ]
S = input() now = 0 ans = 0 for s in S: if now == 0: now += 1 if s == 'p': ans -= 1 continue if s == 'g': ans += 1 now -= 1 print(ans)
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 18, 13, 17, 4, 13, 2, 2, 4, 13, 13, 17, 13, 10, 18, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 29, 3 ], [ 32, 7 ], [ 30, 10 ], [ 26, 12 ], [ 33, 14 ], [ 30, 22 ], [ 27, 24 ], [ 26, 27 ], [ 29, 30 ], [ 32, 33 ] ]
[ "from collections import Counter\ns = input()\ncnt = Counter(s)\nn_p = cnt['p']\nprint(len(s) // 2 - n_p)", "from collections import Counter", "s = input()", "s", "input()", "input", "cnt = Counter(s)", "cnt", "Counter(s)", "Counter", "s", "n_p = cnt['p']", "n_p", "cnt['p']", "cnt", "'p'", "print(len(s) // 2 - n_p)", "print", "len(s) // 2 - n_p", "len(s) // 2", "len(s)", "len", "s", "2", "n_p", "n_p = cnt['p']", "cnt['p']", "n_p", "s = input()", "input()", "s", "cnt = Counter(s)", "Counter(s)", "cnt" ]
from collections import Counter s = input() cnt = Counter(s) n_p = cnt['p'] print(len(s) // 2 - n_p)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 12, 11 ], [ 15, 14 ], [ 18, 17 ], [ 4, 17 ], [ 17, 21 ], [ 8, 25 ], [ 44, 25 ], [ 34, 25 ], [ 11, 26 ], [ 41, 26 ], [ 31, 26 ], [ 29, 28 ], [ 32, 31 ], [ 35, 34 ], [ 8, 38 ], [ 44, 38 ], [ 34, 38 ], [ 11, 39 ], [ 41, 39 ], [ 31, 39 ], [ 42, 41 ], [ 45, 44 ], [ 48, 47 ], [ 47, 51 ], [ 28, 51 ], [ 14, 51 ], [ 60, 57 ] ]
[ "def main():\n s = input()\n cr = 0\n cp = 0\n score = 0\n for c in s:\n if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n print(score)\n \n\nif __name__ == '__main__':\n main()", "def main():\n s = input()\n cr = 0\n cp = 0\n score = 0\n for c in s:\n if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n print(score)\n ", "main", "s = input()", "s", "input()", "input", "cr = 0", "cr", "0", "cp = 0", "cp", "0", "score = 0", "score", "0", "for c in s:\n if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n ", "c", "s", "if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n ", "c == 'g'", "c", "'g'", "if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n ", "cr > cp", "cr", "cp", "score += 1", "score", "1", "cp += 1", "cp", "1", "cr += 1", "cr", "1", "if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n ", "cr > cp", "cr", "cp", "cp += 1", "cp", "1", "cr += 1", "cr", "1", "score -= 1", "score", "1", "print(score)", "print", "score", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n s = input()\n cr = 0\n cp = 0\n score = 0\n for c in s:\n if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n print(score)\n ", "def main():\n s = input()\n cr = 0\n cp = 0\n score = 0\n for c in s:\n if c == 'g':\n if cr > cp:\n score += 1\n cp += 1\n else:\n cr += 1\n else:\n if cr > cp:\n cp += 1\n else:\n cr += 1\n score -= 1\n print(score)\n ", "main" ]
def main(): s = input() cr = 0 cp = 0 score = 0 for c in s: if c == 'g': if cr > cp: score += 1 cp += 1 else: cr += 1 else: if cr > cp: cp += 1 else: cr += 1 score -= 1 print(score) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 2, 4, 13, 13, 17, 28, 13, 13, 0, 13, 4, 13, 2, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 32, 2 ], [ 26, 6 ], [ 33, 10 ], [ 14, 13 ], [ 33, 13 ], [ 29, 16 ], [ 13, 20 ], [ 30, 24 ], [ 27, 24 ], [ 26, 27 ], [ 29, 30 ], [ 32, 33 ] ]
[ "S = input()\nres = len(S) // 2\nfor st in S:\n res -= int(st == \"p\")\nprint(res)", "S = input()", "S", "input()", "input", "res = len(S) // 2", "res", "len(S) // 2", "len(S)", "len", "S", "2", "for st in S:\n res -= int(st == \"p\")", "st", "S", "res -= int(st == \"p\")", "res", "int(st == \"p\")", "int", "st == \"p\"", "st", "\"p\"", "print(res)", "print", "res", "res = len(S) // 2", "len(S) // 2", "res", "res -= int(st == \"p\")", "int(st == \"p\")", "res", "S = input()", "input()", "S" ]
S = input() res = len(S) // 2 for st in S: res -= int(st == "p") print(res)
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 0, 13, 2, 13, 13, 4, 13, 2, 2, 13, 17, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 41, 2 ], [ 38, 6 ], [ 42, 9 ], [ 32, 13 ], [ 42, 16 ], [ 35, 20 ], [ 39, 22 ], [ 33, 23 ], [ 36, 28 ], [ 33, 30 ], [ 32, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ] ]
[ "s = input()\nng = s.count(\"g\")\nnp = s.count(\"p\")\nn = ng+np\nprint(n//2-np)", "s = input()", "s", "input()", "input", "ng = s.count(\"g\")", "ng", "s.count(\"g\")", "s.count", "s", "count", "\"g\"", "np = s.count(\"p\")", "np", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "n = ng+np", "n", "ng+np", "ng", "np", "print(n//2-np)", "print", "n//2-np", "n//2", "n", "2", "np", "np = s.count(\"p\")", "s.count(\"p\")", "np", "n = ng+np", "ng+np", "n", "ng = s.count(\"g\")", "s.count(\"g\")", "ng", "s = input()", "input()", "s" ]
s = input() ng = s.count("g") np = s.count("p") n = ng+np print(n//2-np)
[ 7, 15, 13, 15, 13, 15, 4, 18, 13, 13, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 12, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 12, 4, 13, 4, 13, 0, 13, 12, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 12, 4, 13, 4, 13, 0, 13, 12, 4, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 17, 2, 2, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 13, 9, 14, 2, 18, 13, 13, 17, 0, 13, 17, 9, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 120, 12 ], [ 132, 19 ], [ 126, 31 ], [ 133, 36 ], [ 135, 38 ], [ 133, 46 ], [ 129, 49 ], [ 136, 54 ], [ 123, 56 ], [ 133, 59 ], [ 64, 63 ], [ 124, 65 ], [ 68, 67 ], [ 63, 70 ], [ 73, 72 ], [ 67, 77 ], [ 82, 81 ], [ 85, 84 ], [ 67, 87 ], [ 63, 91 ], [ 84, 92 ], [ 72, 94 ], [ 84, 95 ], [ 63, 100 ], [ 84, 101 ], [ 105, 104 ], [ 109, 108 ], [ 108, 112 ], [ 104, 112 ], [ 81, 112 ], [ 139, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ] ]
[ "import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef main():\n S = SI()\n N = len(S)\n A = \"gp\" * (N//2 + 1)\n ans = 0\n for i in range(N):\n if S[i] == A[i]:\n continue\n if S[i] == \"g\":\n ans += 1\n continue\n ans -= 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "import math", "math", "from collections import deque", "sys.setrecursionlimit(1000000)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "1000000", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "input = lambda: sys.stdin.readline().strip()", "input", "lambda: sys.stdin.readline().strip()", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "NI = lambda: int(input())", "NI", "lambda: int(input())", "int(input())", "int", "input()", "input", "NMI = lambda: map(int, input().split())", "NMI", "lambda: map(int, input().split())", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "NLI = lambda: list(NMI())", "NLI", "lambda: list(NMI())", "list(NMI())", "list", "NMI()", "NMI", "SI = lambda: input()", "SI", "lambda: input()", "input()", "input", "def main():\n S = SI()\n N = len(S)\n A = \"gp\" * (N//2 + 1)\n ans = 0\n for i in range(N):\n if S[i] == A[i]:\n continue\n if S[i] == \"g\":\n ans += 1\n continue\n ans -= 1\n print(ans)", "main", "S = SI()", "S", "SI()", "SI", "N = len(S)", "N", "len(S)", "len", "S", "A = \"gp\" * (N//2 + 1)", "A", "\"gp\" * (N//2 + 1)", "\"gp\"", "N//2 + 1", "N//2", "N", "2", "1", "ans = 0", "ans", "0", "for i in range(N):\n if S[i] == A[i]:\n continue\n if S[i] == \"g\":\n ans += 1\n continue\n ans -= 1\n ", "i", "range(N)", "range", "N", "if S[i] == A[i]:\n continue\n ", "S[i] == A[i]", "S[i]", "S", "i", "A[i]", "A", "i", "continue", "if S[i] == \"g\":\n ans += 1\n continue\n ", "S[i] == \"g\"", "S[i]", "S", "i", "\"g\"", "ans += 1", "ans", "1", "continue", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "SI = lambda: input()", "lambda: input()", "SI", "NI = lambda: int(input())", "lambda: int(input())", "NI", "NLI = lambda: list(NMI())", "lambda: list(NMI())", "NLI", "input = lambda: sys.stdin.readline().strip()", "lambda: sys.stdin.readline().strip()", "input", "NMI = lambda: map(int, input().split())", "lambda: map(int, input().split())", "NMI", "def main():\n S = SI()\n N = len(S)\n A = \"gp\" * (N//2 + 1)\n ans = 0\n for i in range(N):\n if S[i] == A[i]:\n continue\n if S[i] == \"g\":\n ans += 1\n continue\n ans -= 1\n print(ans)", "def main():\n S = SI()\n N = len(S)\n A = \"gp\" * (N//2 + 1)\n ans = 0\n for i in range(N):\n if S[i] == A[i]:\n continue\n if S[i] == \"g\":\n ans += 1\n continue\n ans -= 1\n print(ans)", "main" ]
import sys import math from collections import deque sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def main(): S = SI() N = len(S) A = "gp" * (N//2 + 1) ans = 0 for i in range(N): if S[i] == A[i]: continue if S[i] == "g": ans += 1 continue ans -= 1 print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 2, 2, 4, 13, 13, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 40, 2 ], [ 34, 6 ], [ 10, 9 ], [ 41, 14 ], [ 41, 18 ], [ 9, 19 ], [ 37, 22 ], [ 41, 30 ], [ 38, 32 ], [ 35, 32 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ] ]
[ "s=input()\ncounter=0\nfor i in range(len(s)):\n if s[i]=='p':\n counter+=1\nprint(len(s)//2-counter)", "s=input()", "s", "input()", "input", "counter=0", "counter", "0", "for i in range(len(s)):\n if s[i]=='p':\n counter+=1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i]=='p':\n counter+=1", "s[i]=='p'", "s[i]", "s", "i", "'p'", "counter+=1", "counter", "1", "print(len(s)//2-counter)", "print", "len(s)//2-counter", "len(s)//2", "len(s)", "len", "s", "2", "counter", "counter=0", "0", "counter", "counter+=1", "1", "counter", "s=input()", "input()", "s" ]
s=input() counter=0 for i in range(len(s)): if s[i]=='p': counter+=1 print(len(s)//2-counter)
[ 7, 0, 13, 4, 13, 0, 13, 17, 13, 17, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 79, 2 ], [ 73, 6 ], [ 55, 8 ], [ 64, 10 ], [ 14, 13 ], [ 80, 18 ], [ 80, 22 ], [ 13, 23 ], [ 74, 27 ], [ 83, 27 ], [ 77, 27 ], [ 56, 28 ], [ 71, 28 ], [ 62, 28 ], [ 76, 30 ], [ 67, 33 ], [ 61, 36 ], [ 74, 40 ], [ 83, 40 ], [ 77, 40 ], [ 56, 41 ], [ 71, 41 ], [ 62, 41 ], [ 82, 43 ], [ 70, 46 ], [ 58, 49 ], [ 59, 53 ], [ 68, 53 ], [ 65, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ] ]
[ "s=input()\ng,p,ans=0,0,0\nfor i in range(len(s)):\n if s[i]==\"p\":\n if g==p:\n g+=1\n ans-=1\n else:\n p+=1\n elif g==p:\n g+=1\n else:\n p+=1\n ans+=1\nprint(ans)", "s=input()", "s", "input()", "input", "g,p,ans=0,0,0", "g", "0", "p", "0", "ans", "0", "for i in range(len(s)):\n if s[i]==\"p\":\n if g==p:\n g+=1\n ans-=1\n else:\n p+=1\n elif g==p:\n g+=1\n else:\n p+=1\n ans+=1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i]==\"p\":\n if g==p:\n g+=1\n ans-=1\n else:\n p+=1\n elif g==p:\n g+=1\n else:\n p+=1\n ans+=1", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "if g==p:\n g+=1\n ans-=1\n else:\n p+=1\n ", "g==p", "g", "p", "g+=1", "g", "1", "ans-=1", "ans", "1", "p+=1", "p", "1", "elif g==p:\n g+=1\n ", "g==p", "g", "p", "g+=1", "g", "1", "p+=1", "p", "1", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "p,ans=0,0,0", "0", "p", "ans+=1", "1", "ans", "p+=1", "1", "p", "ans=0,0,0", "0", "ans", "ans-=1", "1", "ans", "p+=1", "1", "p", "g,p,ans=0,0,0", "0", "g", "g+=1", "1", "g", "s=input()", "input()", "s", "g+=1", "1", "g" ]
s=input() g,p,ans=0,0,0 for i in range(len(s)): if s[i]=="p": if g==p: g+=1 ans-=1 else: p+=1 elif g==p: g+=1 else: p+=1 ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 2, 13, 17, 2, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 40, 13, 13, 0, 13, 17, 14, 2, 2, 13, 17, 2, 13, 13, 0, 13, 17, 14, 2, 2, 13, 17, 40, 13, 13, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 89, 2 ], [ 74, 6 ], [ 83, 9 ], [ 77, 12 ], [ 16, 15 ], [ 90, 15 ], [ 15, 20 ], [ 75, 23 ], [ 99, 23 ], [ 87, 23 ], [ 84, 24 ], [ 96, 24 ], [ 81, 24 ], [ 80, 26 ], [ 92, 29 ], [ 15, 34 ], [ 75, 37 ], [ 99, 37 ], [ 87, 37 ], [ 84, 38 ], [ 96, 38 ], [ 81, 38 ], [ 86, 40 ], [ 15, 45 ], [ 75, 48 ], [ 99, 48 ], [ 87, 48 ], [ 84, 49 ], [ 96, 49 ], [ 81, 49 ], [ 95, 51 ], [ 15, 56 ], [ 75, 59 ], [ 99, 59 ], [ 87, 59 ], [ 84, 60 ], [ 96, 60 ], [ 81, 60 ], [ 98, 62 ], [ 71, 65 ], [ 72, 69 ], [ 93, 69 ], [ 78, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ] ]
[ "s = input()\n\ncntg = 0\ncntp = 0\nscore = 0\nfor c in s:\n if c == 'g' and cntg>cntp:\n cntp += 1\n score += 1\n elif c == 'g' and cntg<=cntp:\n cntg += 1\n elif c == 'p' and cntg>cntp:\n cntp += 1\n elif c == 'p' and cntg<=cntp:\n cntg += 1\n score -= 1\nprint(score)", "s = input()", "s", "input()", "input", "cntg = 0", "cntg", "0", "cntp = 0", "cntp", "0", "score = 0", "score", "0", "for c in s:\n if c == 'g' and cntg>cntp:\n cntp += 1\n score += 1\n elif c == 'g' and cntg<=cntp:\n cntg += 1\n elif c == 'p' and cntg>cntp:\n cntp += 1\n elif c == 'p' and cntg<=cntp:\n cntg += 1\n score -= 1", "c", "s", "if c == 'g' and cntg>cntp:\n cntp += 1\n score += 1\n elif c == 'g' and cntg<=cntp:\n cntg += 1\n elif c == 'p' and cntg>cntp:\n cntp += 1\n elif c == 'p' and cntg<=cntp:\n cntg += 1\n score -= 1", "c == 'g' and cntg>cntp", "c == 'g'", "c", "'g'", "cntg>cntp", "cntg", "cntp", "cntp += 1", "cntp", "1", "score += 1", "score", "1", "elif c == 'g' and cntg<=cntp:\n cntg += 1\n ", "c == 'g' and cntg<=cntp", "c == 'g'", "c", "'g'", "cntg<=cntp", "cntg", "cntp", "cntg += 1", "cntg", "1", "elif c == 'p' and cntg>cntp:\n cntp += 1\n ", "c == 'p' and cntg>cntp", "c == 'p'", "c", "'p'", "cntg>cntp", "cntg", "cntp", "cntp += 1", "cntp", "1", "elif c == 'p' and cntg<=cntp:\n cntg += 1\n score -= 1", "c == 'p' and cntg<=cntp", "c == 'p'", "c", "'p'", "cntg<=cntp", "cntg", "cntp", "cntg += 1", "cntg", "1", "score -= 1", "score", "1", "print(score)", "print", "score", "score -= 1", "1", "score", "cntg = 0", "0", "cntg", "score = 0", "0", "score", "cntp += 1", "1", "cntp", "cntp = 0", "0", "cntp", "cntg += 1", "1", "cntg", "s = input()", "input()", "s", "score += 1", "1", "score", "cntp += 1", "1", "cntp", "cntg += 1", "1", "cntg" ]
s = input() cntg = 0 cntp = 0 score = 0 for c in s: if c == 'g' and cntg>cntp: cntp += 1 score += 1 elif c == 'g' and cntg<=cntp: cntg += 1 elif c == 'p' and cntg>cntp: cntp += 1 elif c == 'p' and cntg<=cntp: cntg += 1 score -= 1 print(score)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 13, 13, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 71, 2 ], [ 65, 6 ], [ 72, 9 ], [ 77, 11 ], [ 74, 14 ], [ 68, 17 ], [ 21, 20 ], [ 66, 23 ], [ 75, 26 ], [ 60, 26 ], [ 69, 27 ], [ 81, 27 ], [ 80, 29 ], [ 72, 34 ], [ 20, 35 ], [ 56, 38 ], [ 59, 41 ], [ 72, 46 ], [ 20, 47 ], [ 62, 50 ], [ 63, 54 ], [ 57, 54 ], [ 78, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ] ]
[ "s=input()\nn=len(s)\nans=0\ng_cnt=0\np_cnt=0\nfor i in range(n):\n # 判定\n if g_cnt>p_cnt:\n # パーを出す\n p_cnt+=1\n if s[i]=='g':\n ans+=1\n else:\n g_cnt+=1\n if s[i]=='p':\n ans-=1\nprint(ans)\n", "s=input()", "s", "input()", "input", "n=len(s)", "n", "len(s)", "len", "s", "ans=0", "ans", "0", "g_cnt=0", "g_cnt", "0", "p_cnt=0", "p_cnt", "0", "for i in range(n):\n # 判定\n if g_cnt>p_cnt:\n # パーを出す\n p_cnt+=1\n if s[i]=='g':\n ans+=1\n else:\n g_cnt+=1\n if s[i]=='p':\n ans-=1", "i", "range(n)", "range", "n", "if g_cnt>p_cnt:\n # パーを出す\n p_cnt+=1\n if s[i]=='g':\n ans+=1\n else:\n g_cnt+=1\n if s[i]=='p':\n ans-=1", "g_cnt>p_cnt", "g_cnt", "p_cnt", "p_cnt+=1", "p_cnt", "1", "if s[i]=='g':\n ans+=1\n ", "s[i]=='g'", "s[i]", "s", "i", "'g'", "ans+=1", "ans", "1", "g_cnt+=1", "g_cnt", "1", "if s[i]=='p':\n ans-=1", "s[i]=='p'", "s[i]", "s", "i", "'p'", "ans-=1", "ans", "1", "print(ans)", "print", "ans", "ans+=1", "1", "ans", "g_cnt+=1", "1", "g_cnt", "ans-=1", "1", "ans", "n=len(s)", "len(s)", "n", "p_cnt=0", "0", "p_cnt", "s=input()", "input()", "s", "g_cnt=0", "0", "g_cnt", "ans=0", "0", "ans", "p_cnt+=1", "1", "p_cnt" ]
s=input() n=len(s) ans=0 g_cnt=0 p_cnt=0 for i in range(n): # 判定 if g_cnt>p_cnt: # パーを出す p_cnt+=1 if s[i]=='g': ans+=1 else: g_cnt+=1 if s[i]=='p': ans-=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 4, 13, 2, 2, 4, 13, 13, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 34, 2 ], [ 31, 6 ], [ 10, 9 ], [ 35, 9 ], [ 9, 13 ], [ 28, 16 ], [ 35, 24 ], [ 29, 26 ], [ 32, 26 ], [ 28, 29 ], [ 31, 32 ], [ 34, 35 ] ]
[ "S = input()\np_cnt = 0\nfor c in S:\n if c == 'p':\n p_cnt += 1\nprint(len(S)//2-p_cnt)", "S = input()", "S", "input()", "input", "p_cnt = 0", "p_cnt", "0", "for c in S:\n if c == 'p':\n p_cnt += 1", "c", "S", "if c == 'p':\n p_cnt += 1", "c == 'p'", "c", "'p'", "p_cnt += 1", "p_cnt", "1", "print(len(S)//2-p_cnt)", "print", "len(S)//2-p_cnt", "len(S)//2", "len(S)", "len", "S", "2", "p_cnt", "p_cnt += 1", "1", "p_cnt", "p_cnt = 0", "0", "p_cnt", "S = input()", "input()", "S" ]
S = input() p_cnt = 0 for c in S: if c == 'p': p_cnt += 1 print(len(S)//2-p_cnt)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 4, 13, 13, 0, 13, 8, 2, 13, 17, 17, 17, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 17, 9, 4, 13, 13, 10, 17, 13, 10, 8, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 61, 2 ], [ 49, 6 ], [ 62, 13 ], [ 52, 15 ], [ 53, 28 ], [ 58, 31 ], [ 53, 39 ], [ 55, 42 ], [ 56, 47 ], [ 59, 47 ], [ 50, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ] ]
[ "S = input()\n\nans = 0\nfor i, s in enumerate(S):\n hand = \"p\" if i & 1 else \"g\"\n if s == \"g\" and hand == \"p\":\n ans += 1\n elif s == \"p\" and hand == \"g\":\n ans -= 1\n else:\n continue\n\nprint(ans)", "S = input()", "S", "input()", "input", "ans = 0", "ans", "0", "for i, s in enumerate(S):\n hand = \"p\" if i & 1 else \"g\"\n if s == \"g\" and hand == \"p\":\n ans += 1\n elif s == \"p\" and hand == \"g\":\n ans -= 1\n else:\n continue", "i", "s", "enumerate(S)", "enumerate", "S", "hand = \"p\" if i & 1 else \"g\"", "hand", "\"p\" if i & 1 else \"g\"", "i & 1", "i", "1", "\"p\"", "\"g\"", "if s == \"g\" and hand == \"p\":\n ans += 1\n elif s == \"p\" and hand == \"g\":\n ans -= 1\n else:\n continue", "s == \"g\" and hand == \"p\"", "s == \"g\"", "s", "\"g\"", "hand == \"p\"", "hand", "\"p\"", "ans += 1", "ans", "1", "elif s == \"p\" and hand == \"g\":\n ans -= 1\n ", "s == \"p\" and hand == \"g\"", "s == \"p\"", "s", "\"p\"", "hand == \"g\"", "hand", "\"g\"", "ans -= 1", "ans", "1", "continue", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "hand = \"p\" if i & 1 else \"g\"", "\"p\" if i & 1 else \"g\"", "hand", "ans -= 1", "1", "ans", "ans += 1", "1", "ans", "S = input()", "input()", "S" ]
S = input() ans = 0 for i, s in enumerate(S): hand = "p" if i & 1 else "g" if s == "g" and hand == "p": ans += 1 elif s == "p" and hand == "g": ans -= 1 else: continue print(ans)
[ 7, 0, 13, 4, 13, 13, 2, 2, 4, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 18, 2 ], [ 19, 10 ], [ 19, 14 ], [ 18, 19 ] ]
[ "s = raw_input()\nprint len(s) / 2 - s.count('p')", "s = raw_input()", "s", "raw_input()", "raw_input", "print", "len(s) / 2 - s.count('p')", "len(s) / 2", "len(s)", "len", "s", "2", "s.count('p')", "s.count", "s", "count", "'p'", "s = raw_input()", "raw_input()", "s" ]
s = raw_input() print len(s) / 2 - s.count('p')
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 17, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 68, 2 ], [ 92, 6 ], [ 71, 9 ], [ 83, 12 ], [ 98, 15 ], [ 19, 18 ], [ 69, 18 ], [ 93, 22 ], [ 78, 22 ], [ 72, 23 ], [ 96, 23 ], [ 86, 25 ], [ 89, 28 ], [ 90, 33 ], [ 87, 33 ], [ 18, 36 ], [ 74, 39 ], [ 90, 44 ], [ 87, 44 ], [ 18, 47 ], [ 80, 50 ], [ 90, 54 ], [ 87, 54 ], [ 77, 57 ], [ 95, 60 ], [ 75, 65 ], [ 84, 65 ], [ 81, 66 ], [ 99, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ] ]
[ "S = input()\n\ng = 0\np = 0\nw = 0\nl = 0\nfor s in S:\n if g <= p:\n t = \"g\"\n else:\n t = \"p\"\n\n if t == \"p\" and s == \"g\":\n w += 1\n elif t == \"g\" and s == \"p\":\n l += 1\n if t == \"g\":\n g += 1\n else:\n p += 1\n\nprint(w-l)", "S = input()", "S", "input()", "input", "g = 0", "g", "0", "p = 0", "p", "0", "w = 0", "w", "0", "l = 0", "l", "0", "for s in S:\n if g <= p:\n t = \"g\"\n else:\n t = \"p\"\n\n if t == \"p\" and s == \"g\":\n w += 1\n elif t == \"g\" and s == \"p\":\n l += 1\n if t == \"g\":\n g += 1\n else:\n p += 1", "s", "S", "if g <= p:\n t = \"g\"\n else:\n t = \"p\"\n\n ", "g <= p", "g", "p", "t = \"g\"", "t", "\"g\"", "t = \"p\"", "t", "\"p\"", "if t == \"p\" and s == \"g\":\n w += 1\n elif t == \"g\" and s == \"p\":\n l += 1\n ", "t == \"p\" and s == \"g\"", "t == \"p\"", "t", "\"p\"", "s == \"g\"", "s", "\"g\"", "w += 1", "w", "1", "elif t == \"g\" and s == \"p\":\n l += 1\n ", "t == \"g\" and s == \"p\"", "t == \"g\"", "t", "\"g\"", "s == \"p\"", "s", "\"p\"", "l += 1", "l", "1", "if t == \"g\":\n g += 1\n else:\n p += 1", "t == \"g\"", "t", "\"g\"", "g += 1", "g", "1", "p += 1", "p", "1", "print(w-l)", "print", "w-l", "w", "l", "S = input()", "input()", "S", "p = 0", "0", "p", "w += 1", "1", "w", "g += 1", "1", "g", "l += 1", "1", "l", "w = 0", "0", "w", "t = \"g\"", "\"g\"", "t", "t = \"p\"", "\"p\"", "t", "g = 0", "0", "g", "p += 1", "1", "p", "l = 0", "0", "l" ]
S = input() g = 0 p = 0 w = 0 l = 0 for s in S: if g <= p: t = "g" else: t = "p" if t == "p" and s == "g": w += 1 elif t == "g" and s == "p": l += 1 if t == "g": g += 1 else: p += 1 print(w-l)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 4, 13, 18, 13, 39, 17, 18, 13, 39, 17, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 46, 2 ], [ 40, 6 ], [ 47, 14 ], [ 47, 18 ], [ 43, 27 ], [ 49, 34 ], [ 50, 38 ], [ 44, 38 ], [ 41, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ] ]
[ "s = input()\nans = 0\nfor t, u in zip(s[::2], s[1::2]):\n if t == 'p':\n ans -= 1\n if u == 'g':\n ans += 1\nprint(ans)", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "for t, u in zip(s[::2], s[1::2]):\n if t == 'p':\n ans -= 1\n if u == 'g':\n ans += 1", "t", "u", "zip(s[::2], s[1::2])", "zip", "s[::2]", "s", "::2", "2", "s[1::2]", "s", "1::2", "1", "2", "if t == 'p':\n ans -= 1\n ", "t == 'p'", "t", "'p'", "ans -= 1", "ans", "1", "if u == 'g':\n ans += 1", "u == 'g'", "u", "'g'", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "ans -= 1", "1", "ans", "s = input()", "input()", "s", "ans += 1", "1", "ans" ]
s = input() ans = 0 for t, u in zip(s[::2], s[1::2]): if t == 'p': ans -= 1 if u == 'g': ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 64, 2 ], [ 61, 6 ], [ 58, 9 ], [ 13, 12 ], [ 65, 12 ], [ 59, 16 ], [ 56, 16 ], [ 47, 16 ], [ 55, 19 ], [ 12, 23 ], [ 52, 26 ], [ 59, 30 ], [ 56, 30 ], [ 47, 30 ], [ 46, 33 ], [ 12, 37 ], [ 49, 40 ], [ 50, 44 ], [ 53, 44 ], [ 62, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ] ]
[ "s = input()\nscore = 0 \ng = 0 \nfor i in s:\n if g == 0:\n g += 1\n if i == \"p\":\n score -= 1\n elif g == 1:\n g -= 1\n if i == 'g':\n score += 1\nprint(score)", "s = input()", "s", "input()", "input", "score = 0", "score", "0", "g = 0", "g", "0", "for i in s:\n if g == 0:\n g += 1\n if i == \"p\":\n score -= 1\n elif g == 1:\n g -= 1\n if i == 'g':\n score += 1", "i", "s", "if g == 0:\n g += 1\n if i == \"p\":\n score -= 1\n elif g == 1:\n g -= 1\n if i == 'g':\n score += 1", "g == 0", "g", "0", "g += 1", "g", "1", "if i == \"p\":\n score -= 1\n ", "i == \"p\"", "i", "\"p\"", "score -= 1", "score", "1", "elif g == 1:\n g -= 1\n if i == 'g':\n score += 1", "g == 1", "g", "1", "g -= 1", "g", "1", "if i == 'g':\n score += 1", "i == 'g'", "i", "'g'", "score += 1", "score", "1", "print(score)", "print", "score", "g -= 1", "1", "g", "score += 1", "1", "score", "score -= 1", "1", "score", "g += 1", "1", "g", "g = 0", "0", "g", "score = 0", "0", "score", "s = input()", "input()", "s" ]
s = input() score = 0 g = 0 for i in s: if g == 0: g += 1 if i == "p": score -= 1 elif g == 1: g -= 1 if i == 'g': score += 1 print(score)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 13, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 101, 2 ], [ 92, 6 ], [ 89, 9 ], [ 13, 12 ], [ 102, 18 ], [ 98, 21 ], [ 25, 24 ], [ 102, 30 ], [ 99, 33 ], [ 93, 33 ], [ 104, 35 ], [ 39, 38 ], [ 102, 43 ], [ 102, 47 ], [ 38, 48 ], [ 105, 50 ], [ 99, 50 ], [ 93, 50 ], [ 38, 51 ], [ 107, 53 ], [ 102, 59 ], [ 38, 60 ], [ 105, 64 ], [ 99, 64 ], [ 93, 64 ], [ 38, 65 ], [ 95, 68 ], [ 102, 74 ], [ 38, 75 ], [ 105, 79 ], [ 99, 79 ], [ 93, 79 ], [ 38, 80 ], [ 110, 83 ], [ 111, 87 ], [ 96, 87 ], [ 108, 87 ], [ 90, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "a = input()\nb = \"\"\nc = 0\nfor i in range(len(a)//2):\n b += \"p\"\nfor i in range(len(a) - len(b)):\n b += \"g\"\nfor i in range(len(a)):\n if a[i] == b[i]:\n c += 0\n elif a[i] == \"g\" and b[i] == \"p\":\n c += 1\n elif a[i] == \"p\" and b[i] == \"g\":\n c -= 1\nprint(c)", "a = input()", "a", "input()", "input", "b = \"\"", "b", "\"\"", "c = 0", "c", "0", "for i in range(len(a)//2):\n b += \"p\"", "i", "range(len(a)//2)", "range", "len(a)//2", "len(a)", "len", "a", "2", "b += \"p\"", "b", "\"p\"", "for i in range(len(a) - len(b)):\n b += \"g\"", "i", "range(len(a) - len(b))", "range", "len(a) - len(b)", "len(a)", "len", "a", "len(b)", "len", "b", "b += \"g\"", "b", "\"g\"", "for i in range(len(a)):\n if a[i] == b[i]:\n c += 0\n elif a[i] == \"g\" and b[i] == \"p\":\n c += 1\n elif a[i] == \"p\" and b[i] == \"g\":\n c -= 1", "i", "range(len(a))", "range", "len(a)", "len", "a", "if a[i] == b[i]:\n c += 0\n elif a[i] == \"g\" and b[i] == \"p\":\n c += 1\n elif a[i] == \"p\" and b[i] == \"g\":\n c -= 1", "a[i] == b[i]", "a[i]", "a", "i", "b[i]", "b", "i", "c += 0", "c", "0", "elif a[i] == \"g\" and b[i] == \"p\":\n c += 1\n ", "a[i] == \"g\" and b[i] == \"p\"", "a[i] == \"g\"", "a[i]", "a", "i", "\"g\"", "b[i] == \"p\"", "b[i]", "b", "i", "\"p\"", "c += 1", "c", "1", "elif a[i] == \"p\" and b[i] == \"g\":\n c -= 1", "a[i] == \"p\" and b[i] == \"g\"", "a[i] == \"p\"", "a[i]", "a", "i", "\"p\"", "b[i] == \"g\"", "b[i]", "b", "i", "\"g\"", "c -= 1", "c", "1", "print(c)", "print", "c", "c = 0", "0", "c", "b = \"\"", "\"\"", "b", "c += 1", "1", "c", "b += \"p\"", "\"p\"", "b", "a = input()", "input()", "a", "b += \"g\"", "\"g\"", "b", "c += 0", "0", "c", "c -= 1", "1", "c" ]
a = input() b = "" c = 0 for i in range(len(a)//2): b += "p" for i in range(len(a) - len(b)): b += "g" for i in range(len(a)): if a[i] == b[i]: c += 0 elif a[i] == "g" and b[i] == "p": c += 1 elif a[i] == "p" and b[i] == "g": c -= 1 print(c)
[ 7, 12, 13, 15, 13, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 18, 4, 13, 13, 0, 13, 4, 13, 13, 41, 28, 13, 13, 4, 8, 2, 13, 17, 17, 17, 0, 13, 4, 13, 13, 4, 13, 2, 2, 13, 17, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 16, 15 ], [ 23, 22 ], [ 15, 25 ], [ 29, 28 ], [ 15, 28 ], [ 28, 33 ], [ 39, 38 ], [ 22, 46 ], [ 38, 48 ], [ 57, 54 ] ]
[ "def main():\n import sys\n import numpy as np\n sys.setrecursionlimit(10**6)\n s = input().strip()\n N = len(s)\n p = sum([1 if si == 'p' else 0 for si in s])\n print(N//2-p)\n\nif __name__ == '__main__':\n main()", "def main():\n import sys\n import numpy as np\n sys.setrecursionlimit(10**6)\n s = input().strip()\n N = len(s)\n p = sum([1 if si == 'p' else 0 for si in s])\n print(N//2-p)", "main", "import sys", "sys", "import numpy as np", "numpy", "sys.setrecursionlimit(10**6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**6", "10", "6", "s = input().strip()", "s", "input().strip()", "().strip", "()", "input", "strip", "N = len(s)", "N", "len(s)", "len", "s", "1 if si == 'p' else 0 for si in s", "for si in s", "si", "s", "for si in s", "1 if si == 'p' else 0", "si == 'p'", "si", "'p'", "1", "0", "p = sum([1 if si == 'p' else 0 for si in s])", "p", "sum([1 if si == 'p' else 0 for si in s])", "sum", "[1 if si == 'p' else 0 for si in s]", "print(N//2-p)", "print", "N//2-p", "N//2", "N", "2", "p", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n import sys\n import numpy as np\n sys.setrecursionlimit(10**6)\n s = input().strip()\n N = len(s)\n p = sum([1 if si == 'p' else 0 for si in s])\n print(N//2-p)", "def main():\n import sys\n import numpy as np\n sys.setrecursionlimit(10**6)\n s = input().strip()\n N = len(s)\n p = sum([1 if si == 'p' else 0 for si in s])\n print(N//2-p)", "main" ]
def main(): import sys import numpy as np sys.setrecursionlimit(10**6) s = input().strip() N = len(s) p = sum([1 if si == 'p' else 0 for si in s]) print(N//2-p) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 2, 2, 13, 2, 2, 2, 13, 13, 17, 17, 17, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 53, 2 ], [ 50, 6 ], [ 44, 9 ], [ 13, 12 ], [ 54, 17 ], [ 54, 21 ], [ 12, 22 ], [ 56, 25 ], [ 47, 28 ], [ 57, 34 ], [ 51, 34 ], [ 57, 38 ], [ 51, 38 ], [ 48, 39 ], [ 45, 39 ], [ 44, 45 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ] ]
[ "s = input()\ng = 0\np = 0\nfor i in range(len(s)):\n if s[i] == 'g':\n g += 1\n else:\n p += 1\nprint(g - (g + p - 1) // 2 - 1)", "s = input()", "s", "input()", "input", "g = 0", "g", "0", "p = 0", "p", "0", "for i in range(len(s)):\n if s[i] == 'g':\n g += 1\n else:\n p += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == 'g':\n g += 1\n else:\n p += 1", "s[i] == 'g'", "s[i]", "s", "i", "'g'", "g += 1", "g", "1", "p += 1", "p", "1", "print(g - (g + p - 1) // 2 - 1)", "print", "g - (g + p - 1) // 2 - 1", "g - (g + p - 1) // 2", "g", "(g + p - 1) // 2", "g + p - 1", "g + p", "g", "p", "1", "2", "1", "p = 0", "0", "p", "p += 1", "1", "p", "g = 0", "0", "g", "s = input()", "input()", "s", "g += 1", "1", "g" ]
s = input() g = 0 p = 0 for i in range(len(s)): if s[i] == 'g': g += 1 else: p += 1 print(g - (g + p - 1) // 2 - 1)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 13, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 43, 2 ], [ 40, 6 ], [ 52, 9 ], [ 13, 12 ], [ 44, 12 ], [ 46, 17 ], [ 12, 21 ], [ 55, 24 ], [ 58, 27 ], [ 12, 31 ], [ 49, 34 ], [ 50, 38 ], [ 56, 38 ], [ 53, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ] ]
[ "s=input()\nnow=0\nans=0\nfor i in s:\n if now:\n now-=1\n if i==\"g\":\n ans+=1\n else:\n now+=1\n if i==\"p\":\n ans-=1\nprint(ans)", "s=input()", "s", "input()", "input", "now=0", "now", "0", "ans=0", "ans", "0", "for i in s:\n if now:\n now-=1\n if i==\"g\":\n ans+=1\n else:\n now+=1\n if i==\"p\":\n ans-=1", "i", "s", "if now:\n now-=1\n if i==\"g\":\n ans+=1\n else:\n now+=1\n if i==\"p\":\n ans-=1", "now", "now-=1", "now", "1", "if i==\"g\":\n ans+=1\n ", "i==\"g\"", "i", "\"g\"", "ans+=1", "ans", "1", "now+=1", "now", "1", "if i==\"p\":\n ans-=1", "i==\"p\"", "i", "\"p\"", "ans-=1", "ans", "1", "print(ans)", "print", "ans", "now=0", "0", "now", "s=input()", "input()", "s", "now-=1", "1", "now", "ans-=1", "1", "ans", "ans=0", "0", "ans", "ans+=1", "1", "ans", "now+=1", "1", "now" ]
s=input() now=0 ans=0 for i in s: if now: now-=1 if i=="g": ans+=1 else: now+=1 if i=="p": ans-=1 print(ans)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 2, 13, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 13, 0, 13, 17, 14, 2, 13, 17, 14, 2, 2, 13, 13, 17, 0, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 13, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 99, 2 ], [ 81, 8 ], [ 87, 10 ], [ 96, 13 ], [ 17, 16 ], [ 100, 16 ], [ 16, 20 ], [ 82, 25 ], [ 85, 25 ], [ 76, 25 ], [ 88, 26 ], [ 79, 26 ], [ 70, 26 ], [ 72, 29 ], [ 69, 32 ], [ 93, 35 ], [ 94, 36 ], [ 97, 36 ], [ 67, 36 ], [ 91, 36 ], [ 73, 36 ], [ 75, 38 ], [ 16, 42 ], [ 82, 47 ], [ 85, 47 ], [ 76, 47 ], [ 88, 48 ], [ 79, 48 ], [ 70, 48 ], [ 90, 51 ], [ 91, 52 ], [ 97, 52 ], [ 67, 52 ], [ 94, 52 ], [ 73, 52 ], [ 78, 54 ], [ 66, 57 ], [ 84, 60 ], [ 67, 64 ], [ 91, 64 ], [ 94, 64 ], [ 73, 64 ], [ 97, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 91, 90 ], [ 97, 90 ], [ 67, 90 ], [ 94, 90 ], [ 73, 90 ], [ 90, 91 ], [ 94, 93 ], [ 97, 93 ], [ 67, 93 ], [ 91, 93 ], [ 73, 93 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ] ]
[ "s = list(input())\n\nnum_g, num_p = 0, 0\nscore = 0\nfor x in s:\n if x == 'g':\n if num_g - num_p > 0:\n score += 1\n num_p += 1\n else:\n score = score\n num_g += 1\n elif x == 'p':\n if num_g - num_p > 0:\n score = score\n num_p += 1\n else:\n score -= 1\n num_g += 1\n\nprint(score)", "s = list(input())", "s", "list(input())", "list", "input()", "input", "num_g, num_p = 0, 0", "num_g", "0", "num_p", "0", "score = 0", "score", "0", "for x in s:\n if x == 'g':\n if num_g - num_p > 0:\n score += 1\n num_p += 1\n else:\n score = score\n num_g += 1\n elif x == 'p':\n if num_g - num_p > 0:\n score = score\n num_p += 1\n else:\n score -= 1\n num_g += 1", "x", "s", "if x == 'g':\n if num_g - num_p > 0:\n score += 1\n num_p += 1\n else:\n score = score\n num_g += 1\n elif x == 'p':\n if num_g - num_p > 0:\n score = score\n num_p += 1\n else:\n score -= 1\n num_g += 1", "x == 'g'", "x", "'g'", "if num_g - num_p > 0:\n score += 1\n num_p += 1\n else:\n score = score\n num_g += 1\n ", "num_g - num_p > 0", "num_g - num_p", "num_g", "num_p", "0", "score += 1", "score", "1", "num_p += 1", "num_p", "1", "score = score", "score", "score", "num_g += 1", "num_g", "1", "elif x == 'p':\n if num_g - num_p > 0:\n score = score\n num_p += 1\n else:\n score -= 1\n num_g += 1", "x == 'p'", "x", "'p'", "if num_g - num_p > 0:\n score = score\n num_p += 1\n else:\n score -= 1\n num_g += 1", "num_g - num_p > 0", "num_g - num_p", "num_g", "num_p", "0", "score = score", "score", "score", "num_p += 1", "num_p", "1", "score -= 1", "score", "1", "num_g += 1", "num_g", "1", "print(score)", "print", "score", "score -= 1", "1", "score", "num_p += 1", "1", "num_p", "score += 1", "1", "score", "num_g += 1", "1", "num_g", "num_p += 1", "1", "num_p", "num_g, num_p = 0, 0", "0", "num_g", "num_g += 1", "1", "num_g", "num_p = 0, 0", "0", "num_p", "score = score", "score", "score", "score = score", "score", "score", "score = 0", "0", "score", "s = list(input())", "list(input())", "s" ]
s = list(input()) num_g, num_p = 0, 0 score = 0 for x in s: if x == 'g': if num_g - num_p > 0: score += 1 num_p += 1 else: score = score num_g += 1 elif x == 'p': if num_g - num_p > 0: score = score num_p += 1 else: score -= 1 num_g += 1 print(score)
[ 7, 0, 13, 4, 13, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 40, 2, 13, 17, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 14, 40, 2, 13, 17, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 64, 2 ], [ 58, 6 ], [ 70, 8 ], [ 85, 11 ], [ 15, 14 ], [ 65, 14 ], [ 14, 18 ], [ 59, 23 ], [ 80, 23 ], [ 83, 23 ], [ 71, 25 ], [ 68, 25 ], [ 77, 25 ], [ 73, 27 ], [ 82, 30 ], [ 76, 33 ], [ 14, 37 ], [ 83, 42 ], [ 59, 42 ], [ 80, 42 ], [ 77, 44 ], [ 71, 44 ], [ 68, 44 ], [ 79, 46 ], [ 61, 49 ], [ 67, 52 ], [ 62, 56 ], [ 74, 56 ], [ 86, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ] ]
[ "s=input()\np,g=0,0\nans=0\nfor i in s:\n if i==\"g\":\n if p+1<=g:\n ans+=1\n p+=1\n else:\n g+=1\n if i==\"p\":\n if p+1<=g:\n p+=1\n else: \n ans-=1\n g+=1\nprint(ans) ", "s=input()", "s", "input()", "input", "p,g=0,0", "p", "0", "g", "0", "ans=0", "ans", "0", "for i in s:\n if i==\"g\":\n if p+1<=g:\n ans+=1\n p+=1\n else:\n g+=1\n if i==\"p\":\n if p+1<=g:\n p+=1\n else: \n ans-=1\n g+=1", "i", "s", "if i==\"g\":\n if p+1<=g:\n ans+=1\n p+=1\n else:\n g+=1\n ", "i==\"g\"", "i", "\"g\"", "if p+1<=g:\n ans+=1\n p+=1\n else:\n g+=1\n ", "p+1<=g", "p+1", "p", "1", "g", "ans+=1", "ans", "1", "p+=1", "p", "1", "g+=1", "g", "1", "if i==\"p\":\n if p+1<=g:\n p+=1\n else: \n ans-=1\n g+=1", "i==\"p\"", "i", "\"p\"", "if p+1<=g:\n p+=1\n else: \n ans-=1\n g+=1", "p+1<=g", "p+1", "p", "1", "g", "p+=1", "p", "1", "ans-=1", "ans", "1", "g+=1", "g", "1", "print(ans)", "print", "ans", "p,g=0,0", "0", "p", "ans-=1", "1", "ans", "s=input()", "input()", "s", "g+=1", "1", "g", "g=0,0", "0", "g", "ans+=1", "1", "ans", "g+=1", "1", "g", "p+=1", "1", "p", "p+=1", "1", "p", "ans=0", "0", "ans" ]
s=input() p,g=0,0 ans=0 for i in s: if i=="g": if p+1<=g: ans+=1 p+=1 else: g+=1 if i=="p": if p+1<=g: p+=1 else: ans-=1 g+=1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 78, 2 ], [ 69, 6 ], [ 79, 9 ], [ 57, 11 ], [ 60, 14 ], [ 18, 17 ], [ 70, 20 ], [ 79, 24 ], [ 17, 25 ], [ 58, 29 ], [ 64, 29 ], [ 67, 29 ], [ 85, 29 ], [ 73, 29 ], [ 72, 32 ], [ 75, 35 ], [ 84, 38 ], [ 58, 42 ], [ 64, 42 ], [ 67, 42 ], [ 85, 42 ], [ 73, 42 ], [ 66, 45 ], [ 63, 48 ], [ 81, 51 ], [ 82, 55 ], [ 76, 55 ], [ 61, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ] ]
[ "# https://atcoder.jp/contests/arc062/tasks/arc062_b\n\nS = input()\nN = len(S)\n\nnum = 0\nans = 0\nfor i in range(N):\n if S[i] == 'g':\n if num > 0:\n num -= 1\n ans += 1\n else:\n num += 1\n else:\n if num > 0:\n num -= 1\n else:\n num += 1\n ans -= 1\n\n# print(S, num, ans)\nprint(ans)", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "num = 0", "num", "0", "ans = 0", "ans", "0", "for i in range(N):\n if S[i] == 'g':\n if num > 0:\n num -= 1\n ans += 1\n else:\n num += 1\n else:\n if num > 0:\n num -= 1\n else:\n num += 1\n ans -= 1\n\n# print(S, num, ans)", "i", "range(N)", "range", "N", "if S[i] == 'g':\n if num > 0:\n num -= 1\n ans += 1\n else:\n num += 1\n else:\n if num > 0:\n num -= 1\n else:\n num += 1\n ans -= 1\n\n# print(S, num, ans)", "S[i] == 'g'", "S[i]", "S", "i", "'g'", "if num > 0:\n num -= 1\n ans += 1\n else:\n num += 1\n ", "num > 0", "num", "0", "num -= 1", "num", "1", "ans += 1", "ans", "1", "num += 1", "num", "1", "if num > 0:\n num -= 1\n else:\n num += 1\n ans -= 1\n\n# print(S, num, ans)", "num > 0", "num", "0", "num -= 1", "num", "1", "num += 1", "num", "1", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "num = 0", "0", "num", "ans = 0", "0", "ans", "num += 1", "1", "num", "num -= 1", "1", "num", "N = len(S)", "len(S)", "N", "num -= 1", "1", "num", "ans += 1", "1", "ans", "S = input()", "input()", "S", "ans -= 1", "1", "ans", "num += 1", "1", "num" ]
# https://atcoder.jp/contests/arc062/tasks/arc062_b S = input() N = len(S) num = 0 ans = 0 for i in range(N): if S[i] == 'g': if num > 0: num -= 1 ans += 1 else: num += 1 else: if num > 0: num -= 1 else: num += 1 ans -= 1 # print(S, num, ans) print(ans)
[ 7, 15, 13, 0, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 4, 13, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 2, 2, 13, 17, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 40, 4 ], [ 46, 15 ], [ 41, 18 ], [ 37, 20 ], [ 41, 23 ], [ 43, 27 ], [ 47, 30 ], [ 38, 32 ], [ 44, 35 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ] ]
[ "import sys\n\ns = sys.stdin.readline().strip()\n\nn = len(s)\np_n = s.count(\"p\")\nans = n // 2 - p_n\nprint(ans)", "import sys", "sys", "s = sys.stdin.readline().strip()", "s", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "n = len(s)", "n", "len(s)", "len", "s", "p_n = s.count(\"p\")", "p_n", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "ans = n // 2 - p_n", "ans", "n // 2 - p_n", "n // 2", "n", "2", "p_n", "print(ans)", "print", "ans", "p_n = s.count(\"p\")", "s.count(\"p\")", "p_n", "s = sys.stdin.readline().strip()", "sys.stdin.readline().strip()", "s", "ans = n // 2 - p_n", "n // 2 - p_n", "ans", "n = len(s)", "len(s)", "n" ]
import sys s = sys.stdin.readline().strip() n = len(s) p_n = s.count("p") ans = n // 2 - p_n print(ans)
[ 7, 15, 0, 13, 4, 13, 0, 13, 21, 22, 17, 17, 22, 17, 17, 41, 28, 13, 13, 4, 18, 13, 13, 0, 13, 13, 0, 13, 17, 28, 13, 13, 4, 13, 13, 0, 13, 2, 13, 17, 0, 13, 18, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 10, 17, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 4, 13, 10, 21, 13, 10, 18, 13 ]
[ [ 66, 3 ], [ 69, 7 ], [ 18, 17 ], [ 67, 17 ], [ 70, 21 ], [ 17, 22 ], [ 60, 24 ], [ 54, 27 ], [ 67, 34 ], [ 57, 36 ], [ 72, 41 ], [ 70, 43 ], [ 63, 46 ], [ 58, 48 ], [ 73, 49 ], [ 64, 52 ], [ 55, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ] ]
[ "from itertools import accumulate\nS = input()\ndic = {\"g\":0, \"p\":1}\n# 最適なのはgpgpgpgpと出し続ける\n# me g-g 0\n# me g-p -1\n# me p-g 1\n# me p-p 0\n# 相手がpのとき、pを出すほうが良い、相手がgのとき、pを出すほうが良い\n# 従って、pが余っている状態のときは常に出し続けるのが良い\nAs = [dic[s] for s in S]\ncnt = 0\nfor i,s in enumerate(S):\n a = i % 2\n b = dic[s]\n cnt += (a-b)\nprint(cnt)", "from itertools import accumulate", "S = input()", "S", "input()", "input", "dic = {\"g\":0, \"p\":1}", "dic", "{\"g\":0, \"p\":1}", "\"g\"", "\"g\"", "0", "\"p\"", "\"p\"", "1", "dic[s] for s in S", "for s in S", "s", "S", "for s in S", "dic[s]", "dic", "s", "As = [dic[s] for s in S]", "As", "[dic[s] for s in S]", "cnt = 0", "cnt", "0", "for i,s in enumerate(S):\n a = i % 2\n b = dic[s]\n cnt += (a-b)", "i", "s", "enumerate(S)", "enumerate", "S", "a = i % 2", "a", "i % 2", "i", "2", "b = dic[s]", "b", "dic[s]", "dic", "s", "cnt += (a-b)", "cnt", "a-b", "a", "b", "print(cnt)", "print", "cnt", "cnt = 0", "0", "cnt", "a = i % 2", "i % 2", "a", "As = [dic[s] for s in S]", "[dic[s] for s in S]", "As", "cnt += (a-b)", "a-b", "cnt", "S = input()", "input()", "S", "dic = {\"g\":0, \"p\":1}", "{\"g\":0, \"p\":1}", "dic", "b = dic[s]", "dic[s]", "b" ]
from itertools import accumulate S = input() dic = {"g":0, "p":1} # 最適なのはgpgpgpgpと出し続ける # me g-g 0 # me g-p -1 # me p-g 1 # me p-p 0 # 相手がpのとき、pを出すほうが良い、相手がgのとき、pを出すほうが良い # 従って、pが余っている状態のときは常に出し続けるのが良い As = [dic[s] for s in S] cnt = 0 for i,s in enumerate(S): a = i % 2 b = dic[s] cnt += (a-b) print(cnt)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 2, 13, 17, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 33, 2 ], [ 39, 6 ], [ 10, 9 ], [ 34, 14 ], [ 34, 18 ], [ 9, 19 ], [ 42, 22 ], [ 36, 25 ], [ 37, 30 ], [ 43, 30 ], [ 40, 30 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "s = input()\ncnt = 0\nfor i in range(len(s)):\n if s[i] == \"g\":\n cnt+=1\n else:\n cnt-=1\n\nprint(cnt//2)", "s = input()", "s", "input()", "input", "cnt = 0", "cnt", "0", "for i in range(len(s)):\n if s[i] == \"g\":\n cnt+=1\n else:\n cnt-=1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == \"g\":\n cnt+=1\n else:\n cnt-=1", "s[i] == \"g\"", "s[i]", "s", "i", "\"g\"", "cnt+=1", "cnt", "1", "cnt-=1", "cnt", "1", "print(cnt//2)", "print", "cnt//2", "cnt", "2", "s = input()", "input()", "s", "cnt-=1", "1", "cnt", "cnt = 0", "0", "cnt", "cnt+=1", "1", "cnt" ]
s = input() cnt = 0 for i in range(len(s)): if s[i] == "g": cnt+=1 else: cnt-=1 print(cnt//2)
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 2, 4, 13, 13, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 35, 2 ], [ 29, 6 ], [ 36, 9 ], [ 32, 13 ], [ 36, 16 ], [ 36, 25 ], [ 30, 27 ], [ 29, 30 ], [ 32, 33 ], [ 35, 36 ] ]
[ "s = input()\np = s.count(\"p\")\ng = s.count(\"g\")\nprint((len(s))//2-p)", "s = input()", "s", "input()", "input", "p = s.count(\"p\")", "p", "s.count(\"p\")", "s.count", "s", "count", "\"p\"", "g = s.count(\"g\")", "g", "s.count(\"g\")", "s.count", "s", "count", "\"g\"", "print((len(s))//2-p)", "print", "(len(s))//2-p", "(len(s))//2", "len(s)", "len", "s", "2", "p", "p = s.count(\"p\")", "s.count(\"p\")", "p", "g = s.count(\"g\")", "s.count(\"g\")", "g", "s = input()", "input()", "s" ]
s = input() p = s.count("p") g = s.count("g") print((len(s))//2-p)
[ 7, 0, 13, 4, 13, 4, 13, 2, 2, 4, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 19, 2 ], [ 20, 11 ], [ 20, 15 ], [ 19, 20 ] ]
[ "S=input();print(len(S)//2-S.count('p'))", "S=input()", "S", "input()", "input", "print(len(S)//2-S.count('p'))", "print", "len(S)//2-S.count('p')", "len(S)//2", "len(S)", "len", "S", "2", "S.count('p')", "S.count", "S", "count", "'p'", "S=input()", "input()", "S" ]
S=input();print(len(S)//2-S.count('p'))
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 40, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 59, 2 ], [ 56, 6 ], [ 60, 9 ], [ 62, 11 ], [ 65, 14 ], [ 18, 17 ], [ 57, 20 ], [ 63, 23 ], [ 72, 23 ], [ 69, 23 ], [ 60, 28 ], [ 17, 29 ], [ 53, 32 ], [ 68, 35 ], [ 60, 40 ], [ 17, 41 ], [ 74, 44 ], [ 71, 47 ], [ 75, 51 ], [ 54, 51 ], [ 66, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ] ]
[ "S = input()\nN = len(S)\n\ncnt = 0\nans = 0\nfor i in range(N):\n if cnt >= 1:\n if S[i] == 'g':\n ans += 1\n cnt -= 1\n else:\n if S[i] == 'p':\n ans -= 1\n cnt += 1\n \nprint(ans)", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "cnt = 0", "cnt", "0", "ans = 0", "ans", "0", "for i in range(N):\n if cnt >= 1:\n if S[i] == 'g':\n ans += 1\n cnt -= 1\n else:\n if S[i] == 'p':\n ans -= 1\n cnt += 1\n ", "i", "range(N)", "range", "N", "if cnt >= 1:\n if S[i] == 'g':\n ans += 1\n cnt -= 1\n else:\n if S[i] == 'p':\n ans -= 1\n cnt += 1\n ", "cnt >= 1", "cnt", "1", "if S[i] == 'g':\n ans += 1\n ", "S[i] == 'g'", "S[i]", "S", "i", "'g'", "ans += 1", "ans", "1", "cnt -= 1", "cnt", "1", "if S[i] == 'p':\n ans -= 1\n ", "S[i] == 'p'", "S[i]", "S", "i", "'p'", "ans -= 1", "ans", "1", "cnt += 1", "cnt", "1", "print(ans)", "print", "ans", "ans += 1", "1", "ans", "N = len(S)", "len(S)", "N", "S = input()", "input()", "S", "cnt = 0", "0", "cnt", "ans = 0", "0", "ans", "cnt -= 1", "1", "cnt", "cnt += 1", "1", "cnt", "ans -= 1", "1", "ans" ]
S = input() N = len(S) cnt = 0 ans = 0 for i in range(N): if cnt >= 1: if S[i] == 'g': ans += 1 cnt -= 1 else: if S[i] == 'p': ans -= 1 cnt += 1 print(ans)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 17, 9, 14, 2, 2, 18, 13, 13, 17, 2, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 108, 2 ], [ 120, 8 ], [ 109, 11 ], [ 99, 13 ], [ 117, 16 ], [ 20, 19 ], [ 121, 22 ], [ 19, 25 ], [ 123, 28 ], [ 109, 35 ], [ 19, 36 ], [ 124, 39 ], [ 100, 39 ], [ 103, 39 ], [ 115, 39 ], [ 94, 39 ], [ 97, 39 ], [ 96, 42 ], [ 109, 48 ], [ 19, 49 ], [ 124, 52 ], [ 100, 52 ], [ 103, 52 ], [ 115, 52 ], [ 94, 52 ], [ 97, 52 ], [ 93, 55 ], [ 111, 58 ], [ 109, 64 ], [ 19, 65 ], [ 124, 68 ], [ 100, 68 ], [ 103, 68 ], [ 115, 68 ], [ 94, 68 ], [ 97, 68 ], [ 114, 71 ], [ 105, 74 ], [ 109, 80 ], [ 19, 81 ], [ 124, 84 ], [ 100, 84 ], [ 103, 84 ], [ 115, 84 ], [ 94, 84 ], [ 97, 84 ], [ 102, 87 ], [ 106, 91 ], [ 112, 91 ], [ 118, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ], [ 102, 103 ], [ 105, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ] ]
[ "s = str(input())\nn = len(s)\nhand = 0\npoint = 0\nfor i in range(n):\n if i==0:\n hand +=1\n continue\n if s[i]==\"p\" and hand>0:\n hand -=1\n elif s[i]==\"p\" and hand ==0:\n hand +=1\n point-=1\n elif s[i]==\"g\" and hand>0:\n hand -=1\n point +=1\n elif s[i]==\"g\" and hand==0:\n hand +=1\nprint(point)", "s = str(input())", "s", "str(input())", "str", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "hand = 0", "hand", "0", "point = 0", "point", "0", "for i in range(n):\n if i==0:\n hand +=1\n continue\n if s[i]==\"p\" and hand>0:\n hand -=1\n elif s[i]==\"p\" and hand ==0:\n hand +=1\n point-=1\n elif s[i]==\"g\" and hand>0:\n hand -=1\n point +=1\n elif s[i]==\"g\" and hand==0:\n hand +=1", "i", "range(n)", "range", "n", "if i==0:\n hand +=1\n continue\n ", "i==0", "i", "0", "hand +=1", "hand", "1", "continue", "if s[i]==\"p\" and hand>0:\n hand -=1\n elif s[i]==\"p\" and hand ==0:\n hand +=1\n point-=1\n elif s[i]==\"g\" and hand>0:\n hand -=1\n point +=1\n elif s[i]==\"g\" and hand==0:\n hand +=1", "s[i]==\"p\" and hand>0", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "hand>0", "hand", "0", "hand -=1", "hand", "1", "elif s[i]==\"p\" and hand ==0:\n hand +=1\n point-=1\n ", "s[i]==\"p\" and hand ==0", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "hand ==0", "hand", "0", "hand +=1", "hand", "1", "point-=1", "point", "1", "elif s[i]==\"g\" and hand>0:\n hand -=1\n point +=1\n ", "s[i]==\"g\" and hand>0", "s[i]==\"g\"", "s[i]", "s", "i", "\"g\"", "hand>0", "hand", "0", "hand -=1", "hand", "1", "point +=1", "point", "1", "elif s[i]==\"g\" and hand==0:\n hand +=1", "s[i]==\"g\" and hand==0", "s[i]==\"g\"", "s[i]", "s", "i", "\"g\"", "hand==0", "hand", "0", "hand +=1", "hand", "1", "print(point)", "print", "point", "hand +=1", "1", "hand", "hand -=1", "1", "hand", "hand = 0", "0", "hand", "hand +=1", "1", "hand", "point +=1", "1", "point", "s = str(input())", "str(input())", "s", "point-=1", "1", "point", "hand -=1", "1", "hand", "point = 0", "0", "point", "n = len(s)", "len(s)", "n", "hand +=1", "1", "hand" ]
s = str(input()) n = len(s) hand = 0 point = 0 for i in range(n): if i==0: hand +=1 continue if s[i]=="p" and hand>0: hand -=1 elif s[i]=="p" and hand ==0: hand +=1 point-=1 elif s[i]=="g" and hand>0: hand -=1 point +=1 elif s[i]=="g" and hand==0: hand +=1 print(point)
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 12, 13, 0, 13, 4, 18, 4, 18, 4, 13, 13, 13, 17, 0, 13, 18, 13, 39, 17, 0, 13, 18, 13, 39, 17, 17, 4, 13, 2, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 14, 2, 13, 17, 4, 13, 10, 18, 13, 10, 18, 13, 10, 12, 13, 10, 18, 13 ]
[ [ 76, 4 ], [ 85, 13 ], [ 79, 22 ], [ 34, 33 ], [ 86, 39 ], [ 45, 44 ], [ 33, 46 ], [ 51, 50 ], [ 33, 52 ], [ 50, 61 ], [ 44, 66 ], [ 83, 74 ], [ 76, 77 ], [ 79, 80 ], [ 85, 86 ] ]
[ "import sys\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\ninputs= sys.stdin.buffer.readlines\n#rstrip().decode('utf-8')\n\n#import numpy as np\n#import operator\n#import bisect\n#from heapq import heapify,heappop,heappush\n#from math import gcd\n#from fractions import gcd\n#from collections import deque\n#from collections import defaultdict\n#from collections import Counter\n#from itertools import accumulate\n#from itertools import groupby\n#from itertools import permutations\n#from itertools import combinations\n#scipy.sparse import csr_matrix\n#scipy.sparse.csgraph import floyd_warshall\n#from scipy.sparse.csgraph import csgraph_from_dense\n#from scipy.sparse.csgraph import dijkstra\n#sys.setrecursionlimit(10**7)\n\n#map(int,input().split())\n\ndef main():\n s=input().rstrip().decode('utf-8')\n s0=s[::2]\n s1=s[1::2]\n print(s1.count(\"g\")-s0.count(\"p\"))\n\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "read = sys.stdin.buffer.read", "read", "sys.stdin.buffer.read", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "read", "input = sys.stdin.buffer.readline", "input", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "inputs= sys.stdin.buffer.readlines", "inputs", "sys.stdin.buffer.readlines", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readlines", "def main():\n s=input().rstrip().decode('utf-8')\n s0=s[::2]\n s1=s[1::2]\n print(s1.count(\"g\")-s0.count(\"p\"))", "main", "s=input().rstrip().decode('utf-8')", "s", "input().rstrip().decode('utf-8')", "().rstrip().decode", "().rstrip()", "().rstrip", "()", "input", "rstrip", "decode", "'utf-8'", "s0=s[::2]", "s0", "s[::2]", "s", "::2", "2", "s1=s[1::2]", "s1", "s[1::2]", "s", "1::2", "1", "2", "print(s1.count(\"g\")-s0.count(\"p\"))", "print", "s1.count(\"g\")-s0.count(\"p\")", "s1.count(\"g\")", "s1.count", "s1", "count", "\"g\"", "s0.count(\"p\")", "s0.count", "s0", "count", "\"p\"", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "read = sys.stdin.buffer.read", "sys.stdin.buffer.read", "read", "inputs= sys.stdin.buffer.readlines", "sys.stdin.buffer.readlines", "inputs", "def main():\n s=input().rstrip().decode('utf-8')\n s0=s[::2]\n s1=s[1::2]\n print(s1.count(\"g\")-s0.count(\"p\"))", "def main():\n s=input().rstrip().decode('utf-8')\n s0=s[::2]\n s1=s[1::2]\n print(s1.count(\"g\")-s0.count(\"p\"))", "main", "input = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "input" ]
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs= sys.stdin.buffer.readlines #rstrip().decode('utf-8') #import numpy as np #import operator #import bisect #from heapq import heapify,heappop,heappush #from math import gcd #from fractions import gcd #from collections import deque #from collections import defaultdict #from collections import Counter #from itertools import accumulate #from itertools import groupby #from itertools import permutations #from itertools import combinations #scipy.sparse import csr_matrix #scipy.sparse.csgraph import floyd_warshall #from scipy.sparse.csgraph import csgraph_from_dense #from scipy.sparse.csgraph import dijkstra #sys.setrecursionlimit(10**7) #map(int,input().split()) def main(): s=input().rstrip().decode('utf-8') s0=s[::2] s1=s[1::2] print(s1.count("g")-s0.count("p")) if __name__ == '__main__': main()
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 18, 4, 13, 39, 17, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 62, 4 ], [ 86, 11 ], [ 63, 14 ], [ 68, 18 ], [ 92, 20 ], [ 89, 23 ], [ 27, 26 ], [ 87, 26 ], [ 26, 30 ], [ 69, 34 ], [ 78, 34 ], [ 72, 34 ], [ 93, 35 ], [ 66, 35 ], [ 81, 35 ], [ 71, 37 ], [ 83, 40 ], [ 80, 43 ], [ 69, 47 ], [ 78, 47 ], [ 72, 47 ], [ 93, 48 ], [ 66, 48 ], [ 81, 48 ], [ 77, 50 ], [ 65, 53 ], [ 74, 56 ], [ 75, 60 ], [ 84, 60 ], [ 90, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ] ]
[ "import sys\ninput = sys.stdin.readline\n\ns = input()[:-1]\np, g = 0, 0\nans = 0\n\nfor si in s:\n if si=='g':\n if p<g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p<g:\n p += 1\n else:\n g += 1\n ans -= 1\n\nprint(ans)", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "s = input()[:-1]", "s", "input()[:-1]", "()", "input", ":-1", "-1", "p, g = 0, 0", "p", "0", "g", "0", "ans = 0", "ans", "0", "for si in s:\n if si=='g':\n if p<g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p<g:\n p += 1\n else:\n g += 1\n ans -= 1", "si", "s", "if si=='g':\n if p<g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p<g:\n p += 1\n else:\n g += 1\n ans -= 1", "si=='g'", "si", "'g'", "if p<g:\n p += 1\n ans += 1\n else:\n g += 1\n ", "p<g", "p", "g", "p += 1", "p", "1", "ans += 1", "ans", "1", "g += 1", "g", "1", "if p<g:\n p += 1\n else:\n g += 1\n ans -= 1", "p<g", "p", "g", "p += 1", "p", "1", "g += 1", "g", "1", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "input = sys.stdin.readline", "sys.stdin.readline", "input", "g += 1", "1", "g", "p, g = 0, 0", "0", "p", "p += 1", "1", "p", "ans -= 1", "1", "ans", "p += 1", "1", "p", "g += 1", "1", "g", "ans += 1", "1", "ans", "s = input()[:-1]", "input()[:-1]", "s", "ans = 0", "0", "ans", "g = 0, 0", "0", "g" ]
import sys input = sys.stdin.readline s = input()[:-1] p, g = 0, 0 ans = 0 for si in s: if si=='g': if p<g: p += 1 ans += 1 else: g += 1 else: if p<g: p += 1 else: g += 1 ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 4, 13, 2, 2, 13, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 40, 2 ], [ 31, 6 ], [ 41, 9 ], [ 34, 11 ], [ 15, 14 ], [ 41, 14 ], [ 14, 18 ], [ 37, 21 ], [ 32, 27 ], [ 38, 29 ], [ 35, 29 ], [ 31, 32 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ] ]
[ "s = input()\nn = len(s)\na = 0\n\nfor t in s:\n if t == 'p':\n a += 1\n\n\nprint(n//2 - a)", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "a = 0", "a", "0", "for t in s:\n if t == 'p':\n a += 1", "t", "s", "if t == 'p':\n a += 1", "t == 'p'", "t", "'p'", "a += 1", "a", "1", "print(n//2 - a)", "print", "n//2 - a", "n//2", "n", "2", "a", "n = len(s)", "len(s)", "n", "a = 0", "0", "a", "a += 1", "1", "a", "s = input()", "input()", "s" ]
s = input() n = len(s) a = 0 for t in s: if t == 'p': a += 1 print(n//2 - a)
[ 7, 0, 13, 4, 13, 4, 13, 2, 2, 4, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 19, 2 ], [ 20, 11 ], [ 20, 15 ], [ 19, 20 ] ]
[ "S=input()\nprint(len(S)//2-S.count(\"p\"))", "S=input()", "S", "input()", "input", "print(len(S)//2-S.count(\"p\"))", "print", "len(S)//2-S.count(\"p\")", "len(S)//2", "len(S)", "len", "S", "2", "S.count(\"p\")", "S.count", "S", "count", "\"p\"", "S=input()", "input()", "S" ]
S=input() print(len(S)//2-S.count("p"))
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 2, 2, 13, 17, 17, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 2, 2, 13, 17, 17, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 52, 2 ], [ 55, 6 ], [ 10, 9 ], [ 53, 14 ], [ 9, 19 ], [ 53, 24 ], [ 9, 25 ], [ 58, 28 ], [ 9, 34 ], [ 53, 39 ], [ 9, 40 ], [ 49, 43 ], [ 50, 47 ], [ 59, 47 ], [ 56, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ] ]
[ "S=input()\n\nK=0\nfor i in range(len(S)):\n if i%2==0 and S[i]==\"p\":\n K-=1\n elif i%2==1 and S[i]==\"g\":\n K+=1\nprint(K)", "S=input()", "S", "input()", "input", "K=0", "K", "0", "for i in range(len(S)):\n if i%2==0 and S[i]==\"p\":\n K-=1\n elif i%2==1 and S[i]==\"g\":\n K+=1", "i", "range(len(S))", "range", "len(S)", "len", "S", "if i%2==0 and S[i]==\"p\":\n K-=1\n elif i%2==1 and S[i]==\"g\":\n K+=1", "i%2==0 and S[i]==\"p\"", "i%2==0", "i%2", "i", "2", "0", "S[i]==\"p\"", "S[i]", "S", "i", "\"p\"", "K-=1", "K", "1", "elif i%2==1 and S[i]==\"g\":\n K+=1", "i%2==1 and S[i]==\"g\"", "i%2==1", "i%2", "i", "2", "1", "S[i]==\"g\"", "S[i]", "S", "i", "\"g\"", "K+=1", "K", "1", "print(K)", "print", "K", "K+=1", "1", "K", "S=input()", "input()", "S", "K=0", "0", "K", "K-=1", "1", "K" ]
S=input() K=0 for i in range(len(S)): if i%2==0 and S[i]=="p": K-=1 elif i%2==1 and S[i]=="g": K+=1 print(K)
[ 7, 0, 13, 4, 18, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 2, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 41, 2 ], [ 47, 9 ], [ 42, 12 ], [ 53, 14 ], [ 18, 17 ], [ 48, 20 ], [ 42, 24 ], [ 17, 25 ], [ 50, 28 ], [ 44, 31 ], [ 48, 33 ], [ 45, 38 ], [ 51, 39 ], [ 54, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ] ]
[ "s = input().strip()\nn = len(s)\nop = 0\nfor i in range(n):\n if s[i]=='p':\n op += 1\np = n//2\nprint(p-op)\n", "s = input().strip()", "s", "input().strip()", "().strip", "()", "input", "strip", "n = len(s)", "n", "len(s)", "len", "s", "op = 0", "op", "0", "for i in range(n):\n if s[i]=='p':\n op += 1", "i", "range(n)", "range", "n", "if s[i]=='p':\n op += 1", "s[i]=='p'", "s[i]", "s", "i", "'p'", "op += 1", "op", "1", "p = n//2", "p", "n//2", "n", "2", "print(p-op)", "print", "p-op", "p", "op", "s = input().strip()", "input().strip()", "s", "p = n//2", "n//2", "p", "n = len(s)", "len(s)", "n", "op += 1", "1", "op", "op = 0", "0", "op" ]
s = input().strip() n = len(s) op = 0 for i in range(n): if s[i]=='p': op += 1 p = n//2 print(p-op)
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 4, 13, 13, 28, 13, 13, 0, 18, 13, 13, 17, 0, 13, 2, 13, 17, 4, 13, 2, 13, 18, 13, 17, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 43, 3 ], [ 37, 7 ], [ 44, 10 ], [ 46, 12 ], [ 18, 17 ], [ 44, 17 ], [ 23, 20 ], [ 47, 21 ], [ 17, 22 ], [ 40, 25 ], [ 38, 27 ], [ 41, 32 ], [ 47, 34 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ] ]
[ "from collections import defaultdict\ns = input()\nn = len(s)\n\ncnt = defaultdict(int)\nfor x in s:\n cnt[x] += 1\n\ncan_p = n//2\nprint(can_p-cnt['p'])", "from collections import defaultdict", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "cnt = defaultdict(int)", "cnt", "defaultdict(int)", "defaultdict", "int", "for x in s:\n cnt[x] += 1", "x", "s", "cnt[x] += 1", "cnt[x]", "cnt", "x", "1", "can_p = n//2", "can_p", "n//2", "n", "2", "print(can_p-cnt['p'])", "print", "can_p-cnt['p']", "can_p", "cnt['p']", "cnt", "'p'", "n = len(s)", "len(s)", "n", "can_p = n//2", "n//2", "can_p", "s = input()", "input()", "s", "cnt = defaultdict(int)", "defaultdict(int)", "cnt" ]
from collections import defaultdict s = input() n = len(s) cnt = defaultdict(int) for x in s: cnt[x] += 1 can_p = n//2 print(can_p-cnt['p'])
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 2, 13, 13, 4, 13, 2, 13, 17, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 69, 2 ], [ 54, 6 ], [ 57, 9 ], [ 63, 12 ], [ 16, 15 ], [ 70, 20 ], [ 70, 24 ], [ 15, 25 ], [ 72, 28 ], [ 66, 31 ], [ 55, 35 ], [ 76, 35 ], [ 73, 35 ], [ 67, 36 ], [ 58, 36 ], [ 79, 36 ], [ 75, 38 ], [ 78, 41 ], [ 60, 44 ], [ 76, 46 ], [ 73, 46 ], [ 55, 46 ], [ 79, 47 ], [ 67, 47 ], [ 58, 47 ], [ 61, 51 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ] ]
[ "s = input()\ng = 0\np = 0\nans = 0\nfor i in range(len(s)):\n if s[i]==\"g\":\n g+=1\n else:\n p+=1\n if g==p:\n g=0\n p=0\ndif = g-p\nprint(dif//2)", "s = input()", "s", "input()", "input", "g = 0", "g", "0", "p = 0", "p", "0", "ans = 0", "ans", "0", "for i in range(len(s)):\n if s[i]==\"g\":\n g+=1\n else:\n p+=1\n if g==p:\n g=0\n p=0", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i]==\"g\":\n g+=1\n else:\n p+=1\n if g==p:\n g=0\n p=0", "s[i]==\"g\"", "s[i]", "s", "i", "\"g\"", "g+=1", "g", "1", "p+=1", "p", "1", "if g==p:\n g=0\n p=0", "g==p", "g", "p", "g=0", "g", "0", "p=0", "p", "0", "dif = g-p", "dif", "g-p", "g", "p", "print(dif//2)", "print", "dif//2", "dif", "2", "g = 0", "0", "g", "p = 0", "0", "p", "dif = g-p", "g-p", "dif", "ans = 0", "0", "ans", "p+=1", "1", "p", "s = input()", "input()", "s", "g+=1", "1", "g", "g=0", "0", "g", "p=0", "0", "p" ]
s = input() g = 0 p = 0 ans = 0 for i in range(len(s)): if s[i]=="g": g+=1 else: p+=1 if g==p: g=0 p=0 dif = g-p print(dif//2)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 2, 2, 39, 17, 40, 2, 40, 4, 13, 13, 17, 2, 39, 17, 2, 4, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 75, 2 ], [ 78, 8 ], [ 76, 18 ], [ 76, 26 ], [ 84, 29 ], [ 33, 32 ], [ 76, 37 ], [ 76, 42 ], [ 32, 43 ], [ 79, 47 ], [ 32, 48 ], [ 72, 51 ], [ 76, 57 ], [ 32, 58 ], [ 79, 62 ], [ 32, 63 ], [ 81, 66 ], [ 82, 70 ], [ 73, 70 ], [ 85, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ] ]
[ "s = list(input())\na = [\"g\"] * (-(-len(s) // 2)) + [\"p\"] * (len(s) // 2)\nans = 0\nfor i in range(len(s)):\n if s[i] == \"g\" and a[i] == \"p\":\n ans += 1\n elif s[i] == \"p\" and a[i] == \"g\":\n ans -= 1\nprint(ans)", "s = list(input())", "s", "list(input())", "list", "input()", "input", "a = [\"g\"] * (-(-len(s) // 2)) + [\"p\"] * (len(s) // 2)", "a", "[\"g\"] * (-(-len(s) // 2)) + [\"p\"] * (len(s) // 2)", "[\"g\"] * (-(-len(s) // 2))", "[\"g\"]", "\"g\"", "-(-len(s) // 2)", "-len(s) // 2", "-len(s)", "len(s)", "len", "s", "2", "[\"p\"] * (len(s) // 2)", "[\"p\"]", "\"p\"", "len(s) // 2", "len(s)", "len", "s", "2", "ans = 0", "ans", "0", "for i in range(len(s)):\n if s[i] == \"g\" and a[i] == \"p\":\n ans += 1\n elif s[i] == \"p\" and a[i] == \"g\":\n ans -= 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == \"g\" and a[i] == \"p\":\n ans += 1\n elif s[i] == \"p\" and a[i] == \"g\":\n ans -= 1", "s[i] == \"g\" and a[i] == \"p\"", "s[i] == \"g\"", "s[i]", "s", "i", "\"g\"", "a[i] == \"p\"", "a[i]", "a", "i", "\"p\"", "ans += 1", "ans", "1", "elif s[i] == \"p\" and a[i] == \"g\":\n ans -= 1", "s[i] == \"p\" and a[i] == \"g\"", "s[i] == \"p\"", "s[i]", "s", "i", "\"p\"", "a[i] == \"g\"", "a[i]", "a", "i", "\"g\"", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "ans += 1", "1", "ans", "s = list(input())", "list(input())", "s", "a = [\"g\"] * (-(-len(s) // 2)) + [\"p\"] * (len(s) // 2)", "[\"g\"] * (-(-len(s) // 2)) + [\"p\"] * (len(s) // 2)", "a", "ans -= 1", "1", "ans", "ans = 0", "0", "ans" ]
s = list(input()) a = ["g"] * (-(-len(s) // 2)) + ["p"] * (len(s) // 2) ans = 0 for i in range(len(s)): if s[i] == "g" and a[i] == "p": ans += 1 elif s[i] == "p" and a[i] == "g": ans -= 1 print(ans)
[ 7, 17, 15, 13, 12, 13, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 29, 13, 23, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 13, 23, 13, 14, 2, 13, 17, 4, 13, 18, 18, 13, 13, 39, 17, 10, 12, 13, 10, 12, 13 ]
[ [ 8, 7 ], [ 10, 9 ], [ 13, 12 ], [ 16, 15 ], [ 44, 15 ], [ 7, 19 ], [ 32, 19 ], [ 9, 20 ], [ 22, 20 ], [ 23, 22 ], [ 15, 26 ], [ 30, 29 ], [ 33, 32 ], [ 15, 36 ], [ 40, 39 ], [ 39, 42 ], [ 29, 42 ], [ 12, 42 ], [ 44, 44 ], [ 49, 48 ], [ 53, 52 ], [ 78, 54 ], [ 48, 55 ], [ 52, 58 ], [ 60, 60 ], [ 75, 66 ] ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nD - AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper\nhttps://atcoder.jp/contests/arc062/tasks/arc062_b\n\n\"\"\"\nimport sys\n\n\ndef solve(s):\n rock, paper = 0, 0\n ans = 0\n for h in s:\n if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n return ans\n\n\ndef main(args):\n s = input()\n ans = solve(s)\n print(ans)\n\n\nif __name__ == '__main__':\n main(sys.argv[1:])", "\"\"\"\nD - AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper\nhttps://atcoder.jp/contests/arc062/tasks/arc062_b\n\n\"\"\"", "import sys", "sys", "def solve(s):\n rock, paper = 0, 0\n ans = 0\n for h in s:\n if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n return ans", "solve", "rock, paper = 0, 0", "rock", "0", "paper", "0", "ans = 0", "ans", "0", "for h in s:\n if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n ", "h", "s", "if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n ", "rock > paper", "rock", "paper", "paper += 1", "paper", "1", "if h == 'g':\n ans += 1\n ", "h == 'g'", "h", "'g'", "ans += 1", "ans", "1", "rock += 1", "rock", "1", "if h == 'p':\n ans -=1\n ", "h == 'p'", "h", "'p'", "ans -=1", "ans", "1", "return ans", "ans", "s", "s", "def main(args):\n s = input()\n ans = solve(s)\n print(ans)", "main", "s = input()", "s", "input()", "input", "ans = solve(s)", "ans", "solve(s)", "solve", "s", "print(ans)", "print", "ans", "args", "args", "if __name__ == '__main__':\n main(sys.argv[1:])", "__name__ == '__main__'", "__name__", "'__main__'", "main(sys.argv[1:])", "main", "sys.argv[1:]", "sys.argv", "sys", "argv", "1:", "1", "def main(args):\n s = input()\n ans = solve(s)\n print(ans)", "def main(args):\n s = input()\n ans = solve(s)\n print(ans)", "main", "def solve(s):\n rock, paper = 0, 0\n ans = 0\n for h in s:\n if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n return ans", "def solve(s):\n rock, paper = 0, 0\n ans = 0\n for h in s:\n if rock > paper:\n paper += 1\n if h == 'g':\n ans += 1\n else:\n rock += 1\n if h == 'p':\n ans -=1\n return ans", "solve" ]
# -*- coding: utf-8 -*- """ D - AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper https://atcoder.jp/contests/arc062/tasks/arc062_b """ import sys def solve(s): rock, paper = 0, 0 ans = 0 for h in s: if rock > paper: paper += 1 if h == 'g': ans += 1 else: rock += 1 if h == 'p': ans -=1 return ans def main(args): s = input() ans = solve(s) print(ans) if __name__ == '__main__': main(sys.argv[1:])
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 40, 2 ], [ 49, 6 ], [ 41, 9 ], [ 43, 11 ], [ 50, 13 ], [ 52, 16 ], [ 20, 19 ], [ 50, 22 ], [ 41, 26 ], [ 19, 27 ], [ 46, 30 ], [ 44, 37 ], [ 47, 38 ], [ 53, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ] ]
[ "s = input()\nlens = len(s)\n# パーとグーを置換すると、その前後でスコアは変わらない\n# ggの時,pgとgpの点数はともに1\n# gpの時,pgとgpの点数はともに0 って感じ\n#ので、パーをばらけさせても後ろに固めても回数が同じなら結果は同じ -> AtcoDeerくんがパーを出せる回数 - TopcoDeerくんがパーを出した回数が答え\nnumpar = lens // 2\ntoppar = 0\nfor i in range(lens):\n if s[i] == \"p\":\n toppar += 1\nprint(str(numpar - toppar))", "s = input()", "s", "input()", "input", "lens = len(s)", "lens", "len(s)", "len", "s", "numpar = lens // 2", "numpar", "lens // 2", "lens", "2", "toppar = 0", "toppar", "0", "for i in range(lens):\n if s[i] == \"p\":\n toppar += 1", "i", "range(lens)", "range", "lens", "if s[i] == \"p\":\n toppar += 1", "s[i] == \"p\"", "s[i]", "s", "i", "\"p\"", "toppar += 1", "toppar", "1", "print(str(numpar - toppar))", "print", "str(numpar - toppar)", "str", "numpar - toppar", "numpar", "toppar", "s = input()", "input()", "s", "numpar = lens // 2", "lens // 2", "numpar", "toppar += 1", "1", "toppar", "lens = len(s)", "len(s)", "lens", "toppar = 0", "0", "toppar" ]
s = input() lens = len(s) # パーとグーを置換すると、その前後でスコアは変わらない # ggの時,pgとgpの点数はともに1 # gpの時,pgとgpの点数はともに0 って感じ #ので、パーをばらけさせても後ろに固めても回数が同じなら結果は同じ -> AtcoDeerくんがパーを出せる回数 - TopcoDeerくんがパーを出した回数が答え numpar = lens // 2 toppar = 0 for i in range(lens): if s[i] == "p": toppar += 1 print(str(numpar - toppar))
[ 7, 0, 13, 4, 13, 15, 0, 13, 2, 4, 13, 13, 17, 0, 13, 4, 13, 13, 4, 13, 2, 2, 2, 18, 13, 17, 18, 13, 17, 13, 17, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 35, 2 ], [ 32, 7 ], [ 36, 11 ], [ 38, 14 ], [ 36, 17 ], [ 39, 24 ], [ 36, 24 ], [ 39, 27 ], [ 36, 27 ], [ 33, 29 ], [ 32, 33 ], [ 35, 36 ], [ 38, 39 ] ]
[ "s=input()\nfrom collections import Counter\nlens=len(s)%2\ns=Counter(s)\nprint(((s[\"g\"]-s[\"p\"])-lens)//2)", "s=input()", "s", "input()", "input", "from collections import Counter", "lens=len(s)%2", "lens", "len(s)%2", "len(s)", "len", "s", "2", "s=Counter(s)", "s", "Counter(s)", "Counter", "s", "print(((s[\"g\"]-s[\"p\"])-lens)//2)", "print", "((s[\"g\"]-s[\"p\"])-lens)//2", "(s[\"g\"]-s[\"p\"])-lens", "s[\"g\"]-s[\"p\"]", "s[\"g\"]", "s", "\"g\"", "s[\"p\"]", "s", "\"p\"", "lens", "2", "lens=len(s)%2", "len(s)%2", "lens", "s=input()", "input()", "s", "s=Counter(s)", "Counter(s)", "s" ]
s=input() from collections import Counter lens=len(s)%2 s=Counter(s) print(((s["g"]-s["p"])-lens)//2)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 70, 2 ], [ 52, 6 ], [ 64, 9 ], [ 13, 12 ], [ 71, 12 ], [ 12, 17 ], [ 53, 20 ], [ 68, 20 ], [ 59, 20 ], [ 56, 20 ], [ 74, 20 ], [ 73, 23 ], [ 76, 26 ], [ 12, 30 ], [ 55, 33 ], [ 53, 37 ], [ 68, 37 ], [ 59, 37 ], [ 56, 37 ], [ 74, 37 ], [ 58, 40 ], [ 67, 43 ], [ 61, 46 ], [ 62, 50 ], [ 77, 50 ], [ 65, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ] ]
[ "s = input()\nhmp = 0\nans = 0\nfor i in s:\n if i == 'g' and hmp > 0:\n hmp -= 1\n ans += 1\n elif i == 'g':\n hmp += 1\n elif hmp > 0:\n hmp -= 1\n else:\n hmp += 1\n ans -= 1\nprint(ans)", "s = input()", "s", "input()", "input", "hmp = 0", "hmp", "0", "ans = 0", "ans", "0", "for i in s:\n if i == 'g' and hmp > 0:\n hmp -= 1\n ans += 1\n elif i == 'g':\n hmp += 1\n elif hmp > 0:\n hmp -= 1\n else:\n hmp += 1\n ans -= 1", "i", "s", "if i == 'g' and hmp > 0:\n hmp -= 1\n ans += 1\n elif i == 'g':\n hmp += 1\n elif hmp > 0:\n hmp -= 1\n else:\n hmp += 1\n ans -= 1", "i == 'g' and hmp > 0", "i == 'g'", "i", "'g'", "hmp > 0", "hmp", "0", "hmp -= 1", "hmp", "1", "ans += 1", "ans", "1", "elif i == 'g':\n hmp += 1\n ", "i == 'g'", "i", "'g'", "hmp += 1", "hmp", "1", "elif hmp > 0:\n hmp -= 1\n ", "hmp > 0", "hmp", "0", "hmp -= 1", "hmp", "1", "hmp += 1", "hmp", "1", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "hmp = 0", "0", "hmp", "hmp += 1", "1", "hmp", "hmp -= 1", "1", "hmp", "ans -= 1", "1", "ans", "ans = 0", "0", "ans", "hmp += 1", "1", "hmp", "s = input()", "input()", "s", "hmp -= 1", "1", "hmp", "ans += 1", "1", "ans" ]
s = input() hmp = 0 ans = 0 for i in s: if i == 'g' and hmp > 0: hmp -= 1 ans += 1 elif i == 'g': hmp += 1 elif hmp > 0: hmp -= 1 else: hmp += 1 ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 2, 4, 13, 13, 17, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 36, 2 ], [ 39, 6 ], [ 30, 9 ], [ 13, 12 ], [ 37, 12 ], [ 12, 16 ], [ 42, 19 ], [ 33, 22 ], [ 37, 26 ], [ 30, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "s = raw_input()\n\nres = 0\npre_sum = 0\n\nfor i in s:\n\tif i == 'p':\n\t\tres -= 1\n\nres += len(s) / 2\n\nprint res", "s = raw_input()", "s", "raw_input()", "raw_input", "res = 0", "res", "0", "pre_sum = 0", "pre_sum", "0", "for i in s:\n\tif i == 'p':\n\t\tres -= 1", "i", "s", "if i == 'p':\n\t\tres -= 1", "i == 'p'", "i", "'p'", "res -= 1", "res", "1", "res += len(s) / 2", "res", "len(s) / 2", "len(s)", "len", "s", "2", "print", "pre_sum = 0", "0", "pre_sum", "res += len(s) / 2", "len(s) / 2", "res", "s = raw_input()", "raw_input()", "s", "res = 0", "0", "res", "res -= 1", "1", "res" ]
s = raw_input() res = 0 pre_sum = 0 for i in s: if i == 'p': res -= 1 res += len(s) / 2 print res
[ 7, 0, 13, 4, 13, 0, 13, 17, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 59, 2 ], [ 77, 6 ], [ 62, 8 ], [ 53, 11 ], [ 15, 14 ], [ 60, 14 ], [ 14, 18 ], [ 78, 22 ], [ 66, 22 ], [ 72, 22 ], [ 63, 23 ], [ 51, 23 ], [ 75, 23 ], [ 71, 25 ], [ 56, 28 ], [ 74, 31 ], [ 78, 35 ], [ 66, 35 ], [ 72, 35 ], [ 63, 36 ], [ 51, 36 ], [ 75, 36 ], [ 65, 38 ], [ 50, 41 ], [ 68, 44 ], [ 69, 48 ], [ 57, 48 ], [ 54, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ] ]
[ "s = input()\np, g = 0, 0\nans = 0\nfor e in s:\n if e == \"g\":\n if p < g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p < g:\n p += 1\n else:\n g += 1\n ans -= 1\nprint(ans)", "s = input()", "s", "input()", "input", "p, g = 0, 0", "p", "0", "g", "0", "ans = 0", "ans", "0", "for e in s:\n if e == \"g\":\n if p < g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p < g:\n p += 1\n else:\n g += 1\n ans -= 1", "e", "s", "if e == \"g\":\n if p < g:\n p += 1\n ans += 1\n else:\n g += 1\n else:\n if p < g:\n p += 1\n else:\n g += 1\n ans -= 1", "e == \"g\"", "e", "\"g\"", "if p < g:\n p += 1\n ans += 1\n else:\n g += 1\n ", "p < g", "p", "g", "p += 1", "p", "1", "ans += 1", "ans", "1", "g += 1", "g", "1", "if p < g:\n p += 1\n else:\n g += 1\n ans -= 1", "p < g", "p", "g", "p += 1", "p", "1", "g += 1", "g", "1", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "g += 1", "1", "g", "ans = 0", "0", "ans", "ans += 1", "1", "ans", "s = input()", "input()", "s", "g = 0, 0", "0", "g", "p += 1", "1", "p", "ans -= 1", "1", "ans", "p += 1", "1", "p", "g += 1", "1", "g", "p, g = 0, 0", "0", "p" ]
s = input() p, g = 0, 0 ans = 0 for e in s: if e == "g": if p < g: p += 1 ans += 1 else: g += 1 else: if p < g: p += 1 else: g += 1 ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 40, 2, 13, 17, 13, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 2, 2, 13, 17, 13, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 40, 2, 13, 17, 13, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 85, 2 ], [ 91, 6 ], [ 97, 9 ], [ 106, 12 ], [ 16, 15 ], [ 86, 20 ], [ 98, 25 ], [ 95, 25 ], [ 101, 25 ], [ 92, 27 ], [ 83, 27 ], [ 89, 27 ], [ 86, 30 ], [ 15, 31 ], [ 100, 34 ], [ 103, 37 ], [ 98, 43 ], [ 95, 43 ], [ 101, 43 ], [ 92, 45 ], [ 83, 45 ], [ 89, 45 ], [ 86, 48 ], [ 15, 49 ], [ 88, 52 ], [ 79, 55 ], [ 98, 61 ], [ 95, 61 ], [ 101, 61 ], [ 92, 63 ], [ 83, 63 ], [ 89, 63 ], [ 86, 66 ], [ 15, 67 ], [ 94, 70 ], [ 82, 73 ], [ 80, 77 ], [ 104, 77 ], [ 107, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ] ]
[ "s = input()\n\nsg = 0\nsp = 0\nans = 0\n\nfor i in range(len(s)):\n if sp+1 <= sg and s[i] == 'g':\n sp += 1\n ans += 1\n elif sp+1 > sg and s[i] == 'p':\n sg += 1\n ans -= 1\n elif sp+1 <= sg and s[i] == 'p':\n sp += 1\n else:\n sg += 1\nprint(ans)", "s = input()", "s", "input()", "input", "sg = 0", "sg", "0", "sp = 0", "sp", "0", "ans = 0", "ans", "0", "for i in range(len(s)):\n if sp+1 <= sg and s[i] == 'g':\n sp += 1\n ans += 1\n elif sp+1 > sg and s[i] == 'p':\n sg += 1\n ans -= 1\n elif sp+1 <= sg and s[i] == 'p':\n sp += 1\n else:\n sg += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if sp+1 <= sg and s[i] == 'g':\n sp += 1\n ans += 1\n elif sp+1 > sg and s[i] == 'p':\n sg += 1\n ans -= 1\n elif sp+1 <= sg and s[i] == 'p':\n sp += 1\n else:\n sg += 1", "sp+1 <= sg and s[i] == 'g'", "sp+1 <= sg", "sp+1", "sp", "1", "sg", "s[i] == 'g'", "s[i]", "s", "i", "'g'", "sp += 1", "sp", "1", "ans += 1", "ans", "1", "elif sp+1 > sg and s[i] == 'p':\n sg += 1\n ans -= 1\n ", "sp+1 > sg and s[i] == 'p'", "sp+1 > sg", "sp+1", "sp", "1", "sg", "s[i] == 'p'", "s[i]", "s", "i", "'p'", "sg += 1", "sg", "1", "ans -= 1", "ans", "1", "elif sp+1 <= sg and s[i] == 'p':\n sp += 1\n ", "sp+1 <= sg and s[i] == 'p'", "sp+1 <= sg", "sp+1", "sp", "1", "sg", "s[i] == 'p'", "s[i]", "s", "i", "'p'", "sp += 1", "sp", "1", "sg += 1", "sg", "1", "print(ans)", "print", "ans", "ans -= 1", "1", "ans", "sg += 1", "1", "sg", "s = input()", "input()", "s", "sg += 1", "1", "sg", "sg = 0", "0", "sg", "sp += 1", "1", "sp", "sp = 0", "0", "sp", "sp += 1", "1", "sp", "ans += 1", "1", "ans", "ans = 0", "0", "ans" ]
s = input() sg = 0 sp = 0 ans = 0 for i in range(len(s)): if sp+1 <= sg and s[i] == 'g': sp += 1 ans += 1 elif sp+1 > sg and s[i] == 'p': sg += 1 ans -= 1 elif sp+1 <= sg and s[i] == 'p': sp += 1 else: sg += 1 print(ans)
[ 7, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 14, 2, 13, 17, 14, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 14, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 56, 2 ], [ 56, 5 ], [ 9, 8 ], [ 8, 13 ], [ 53, 18 ], [ 59, 21 ], [ 44, 24 ], [ 50, 29 ], [ 47, 32 ], [ 62, 35 ], [ 63, 39 ], [ 54, 39 ], [ 42, 39 ], [ 56, 42 ], [ 44, 45 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ] ]
[ "c=w=0\nfor i in input():\n\tif i==\"g\":\n\t\tif c:\n\t\t\tw+=1\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\telse:\n\t\tif c:\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\t\t\tw-=1\nprint(w)", "c=w=0", "c", "0", "=w=0", "w", "0", "for i in input():\n\tif i==\"g\":\n\t\tif c:\n\t\t\tw+=1\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\telse:\n\t\tif c:\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\t\t\tw-=1", "i", "input()", "input", "if i==\"g\":\n\t\tif c:\n\t\t\tw+=1\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\telse:\n\t\tif c:\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\t\t\tw-=1", "i==\"g\"", "i", "\"g\"", "if c:\n\t\t\tw+=1\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\t", "c", "w+=1", "w", "1", "c-=1", "c", "1", "c+=1", "c", "1", "if c:\n\t\t\tc-=1\n\t\telse:\n\t\t\tc+=1\n\t\t\tw-=1", "c", "c-=1", "c", "1", "c+=1", "c", "1", "w-=1", "w", "1", "print(w)", "print", "w", "w=0", "0", "w", "c+=1", "1", "c", "c+=1", "1", "c", "c-=1", "1", "c", "w+=1", "1", "w", "c=w=0", "0", "c", "c-=1", "1", "c", "w-=1", "1", "w" ]
c=w=0 for i in input(): if i=="g": if c: w+=1 c-=1 else: c+=1 else: if c: c-=1 else: c+=1 w-=1 print(w)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 2, 13, 2, 2, 13, 17, 17, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 57, 2 ], [ 51, 8 ], [ 58, 11 ], [ 60, 13 ], [ 48, 16 ], [ 20, 19 ], [ 52, 22 ], [ 58, 26 ], [ 19, 27 ], [ 45, 30 ], [ 54, 33 ], [ 46, 38 ], [ 61, 38 ], [ 52, 41 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ] ]
[ "S=list(input())\nN=len(S)\n\ng=0\np=0\nfor i in range(N):\n if S[i]==\"g\":\n g+=1\n else:\n p+=1\n \nprint(g-(N+1)//2)", "S=list(input())", "S", "list(input())", "list", "input()", "input", "N=len(S)", "N", "len(S)", "len", "S", "g=0", "g", "0", "p=0", "p", "0", "for i in range(N):\n if S[i]==\"g\":\n g+=1\n else:\n p+=1\n ", "i", "range(N)", "range", "N", "if S[i]==\"g\":\n g+=1\n else:\n p+=1\n ", "S[i]==\"g\"", "S[i]", "S", "i", "\"g\"", "g+=1", "g", "1", "p+=1", "p", "1", "print(g-(N+1)//2)", "print", "g-(N+1)//2", "g", "(N+1)//2", "N+1", "N", "1", "2", "g+=1", "1", "g", "p=0", "0", "p", "N=len(S)", "len(S)", "N", "p+=1", "1", "p", "S=list(input())", "list(input())", "S", "g=0", "0", "g" ]
S=list(input()) N=len(S) g=0 p=0 for i in range(N): if S[i]=="g": g+=1 else: p+=1 print(g-(N+1)//2)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 2, 13, 17, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 49, 2 ], [ 52, 6 ], [ 10, 9 ], [ 50, 14 ], [ 9, 18 ], [ 50, 24 ], [ 9, 25 ], [ 43, 28 ], [ 50, 33 ], [ 9, 34 ], [ 46, 37 ], [ 47, 41 ], [ 44, 41 ], [ 53, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ] ]
[ "s = input()\nans = 0\nfor i in range(len(s)):\n if i%2==0:\n if s[i]==\"p\":\n ans -= 1\n else:\n if s[i] == \"g\":\n ans += 1\nprint(ans)", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "for i in range(len(s)):\n if i%2==0:\n if s[i]==\"p\":\n ans -= 1\n else:\n if s[i] == \"g\":\n ans += 1", "i", "range(len(s))", "range", "len(s)", "len", "s", "if i%2==0:\n if s[i]==\"p\":\n ans -= 1\n else:\n if s[i] == \"g\":\n ans += 1", "i%2==0", "i%2", "i", "2", "0", "if s[i]==\"p\":\n ans -= 1\n ", "s[i]==\"p\"", "s[i]", "s", "i", "\"p\"", "ans -= 1", "ans", "1", "if s[i] == \"g\":\n ans += 1", "s[i] == \"g\"", "s[i]", "s", "i", "\"g\"", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "ans -= 1", "1", "ans", "ans += 1", "1", "ans", "s = input()", "input()", "s", "ans = 0", "0", "ans" ]
s = input() ans = 0 for i in range(len(s)): if i%2==0: if s[i]=="p": ans -= 1 else: if s[i] == "g": ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 2, 2, 4, 13, 13, 17, 4, 13, 2, 13, 17, 4, 13, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 22, 2 ], [ 25, 6 ], [ 23, 11 ], [ 26, 20 ], [ 22, 23 ], [ 25, 26 ] ]
[ "s = input()\nans = len(s)//2 - sum(c=='p' for c in s)\nprint(ans)", "s = input()", "s", "input()", "input", "ans = len(s)//2 - sum(c=='p' for c in s)", "ans", "len(s)//2 - sum(c=='p' for c in s)", "len(s)//2", "len(s)", "len", "s", "2", "sum(c=='p' for c in s)", "sum", "c=='p'", "c", "'p'", "print(ans)", "print", "ans", "s = input()", "input()", "s", "ans = len(s)//2 - sum(c=='p' for c in s)", "len(s)//2 - sum(c=='p' for c in s)", "ans" ]
s = input() ans = len(s)//2 - sum(c=='p' for c in s) print(ans)