qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(str(i) for i in input())

ans = [0] * n
def janken(te):
  if te == 'r':
    return p
  elif te == 's':
    return r
  else:
    return s
    
for i in range(n):
  konkai = janken(t[i])
  if i < k:
    ans[i] = konkai
  elif ans[i-k] != konkai:
    ans[i] = konkai
  else:
    ans[i] = 0

Fixed code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(str(i) for i in input())

ans = [0] * n
def janken(te):
  if te == 'r':
    return p
  elif te == 's':
    return r
  else:
    return s
    
for i in range(n):
  konkai = janken(t[i])
  if i < k:
    ans[i] = konkai
  elif ans[i-k] != konkai:
    ans[i] = konkai
  else:
    if t[i-k] == t[i]:
      ans[i] = 0
    else:
      ans[i] = konkai
print(sum(ans))
Buggy code:
n.k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[k+a] == t[a]:
        t[k+a] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)

Fixed code:
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[k+i] == t[i]:
        t[k+i] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)
Buggy code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
for i in range(n):
    if((i - k) < 0):
        if(t[i] == 'r'):ans += p
        elif(t[i] == 's'):ans += r
        else:ans += s
        continue
    
    else:
        if(t[i-k] == t[i]):t = t[:i] + 'n' + t[i+1:]
        else:
            if(t[i] == 'r'):ans += p
            elif(t[i] == 's'):ans += r 
            else:ans += s
print(score)


Fixed code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
for i in range(n):
    if ((i - k) < 0):
        if (t[i] == 'r'):
            ans += p
        elif (t[i] == 's'):
            ans += r
        else:
            ans += s
        continue

    else:
        if (t[i - k] == t[i]):
            t = t[:i] + 'n' + t[i + 1:]
        else:
            if (t[i] == 'r'):
                ans += p
            elif (t[i] == 's'):
                ans += r
            else:
                ans += s
print(ans)
Buggy code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

o = ''
for j in range(k):
    o1 = (''.join(t[j::k]))
    print(o1)
    o2 = o1.replace('rr', 'r')
    print(o2)
    o3 = o2.replace('pp', 'p')
    print(o3)
    o4 = o3.replace('ss', 's')
    print(o4)
    o += o4

print(o)
x = 0
for i, h in enumerate(o):
    if h == 'r':
        x += p
    elif h == 's':
        x += r
    else:
        x += s

print(x)

Fixed code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

o = ''
for j in range(k):
    o += (''.join(t[j::k])).replace('rr', 'r').replace(
        'pp', 'p').replace('ss', 's')

x = 0
for i, h in enumerate(o):
    if h == 'r':
        x += p
    elif h == 's':
        x += r
    else:
        x += s

print(x)
Buggy code:
N,K=map(int, input().split()) 
R,S,P=map(int, input().split()) 
T=input()
SC=0

def point(w):
    if w=='r':
        return P
    elif w=='s':
        return R
    else:
        return S
    
Flag=[True for i in range(N)]

for i in range(N):
    SC+=point(T[i])
    if i+K<N and T[i]==T[i+K]:
        Flag[i+K]=False
return(SC)

Fixed code:
N,K=map(int, input().split()) 
R,S,P=map(int, input().split()) 
T=input()
SC=0

def point(w):
    if w=='r':
        return P
    elif w=='s':
        return R
    else:
        return S
    
Flag=[True for i in range(N)]

for i in range(N):
    if Flag[i]:
        SC+=point(T[i])
        if i+K<N and T[i]==T[i+K]:
            Flag[i+K]=False
print(SC)
Buggy code:
H = list(map(int, input().split()))
A = list(map(int, input().split()))
T = input()
P=A[2]
R=A[0]
S=A[1]
k=H[1]
ans = 0
T = list(T)

for i in range(int(H[0])):
    a=i-k
    b=T[0]
    if(a<0):
        if(T[i]=="r"):
                ans+=P
                print("p")
        if(T[i]=="s"):
                ans+=R
                print("r")
        if(T[i]=="p"):
                ans+=S
                print("s")
    else:
        if(T[i]=="r"):
            if(T[a] !="r"):
                ans+=P
                print("p")
            else:
                T[i]="l"
                print("n")

        if(T[i]=="s"):
            if(T[a] !="s"):
                ans+=R
                print("r")
            else:
                T[i]="l"
                print("n")
        if(T[i]=="p"):
            if(T[a] !="p"):
                ans+=S
                print("s")
            else:
                T[i]="l"
                print("n")
print(ans)


Fixed code:
H = list(map(int, input().split()))
A = list(map(int, input().split()))
T = input()
P=A[2]
R=A[0]
S=A[1]
k=H[1]
ans = 0
T = list(T)

for i in range(int(H[0])):
    a=i-k
    b=T[0]
    if(a<0):
        if(T[i]=="r"):
                ans+=P
                #print("p")
        if(T[i]=="s"):
                ans+=R
                #print("r")
        if(T[i]=="p"):
                ans+=S
                #print("s")
    else:
        if(T[i]=="r"):
            if(T[a] !="r"):
                ans+=P
                #print("p")
            else:
                T[i]="l"
                #print("n")

        if(T[i]=="s"):
            if(T[a] !="s"):
                ans+=R
                #print("r")
            else:
                T[i]="l"
                #print("n")
        if(T[i]=="p"):
            if(T[a] !="p"):
                ans+=S
                #print("s")
            else:
                T[i]="l"
                #print("n")
print(ans)
Buggy code:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ans = 0
buf = ""
for i in range(N):
    t = T[i]

    if t == "r":
        if i >= K:
            if buf[i - K] == "p":
                buf = buf + " "
                continue
        ans += P
        buf += buf + "p"
    elif t == "p":
        if i >= K:
            if buf[i - K] == "s":
                buf = buf + " "
                continue
        ans += S
        buf += buf + "s"
    elif t == "s":
        if i >= K:
            if buf[i - K] == "r":
                buf = buf + " "
                continue
        ans += R
        buf += buf + "r"

print(ans)

Fixed code:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ans = 0
buf = ""
for i in range(N):
    t = T[i]

    if t == "r":
        if i >= K:
            if buf[i - K] == "p":
                buf = buf + " "
                continue
        ans += P
        buf = buf + "p"
    elif t == "p":
        if i >= K:
            if buf[i - K] == "s":
                buf = buf + " "
                continue
        ans += S
        buf = buf + "s"
    elif t == "s":
        if i >= K:
            if buf[i - K] == "r":
                buf = buf + " "
                continue
        ans += R
        buf = buf + "r"

print(ans)
Buggy code:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())

ans=0

for j in range(len(T)):
    if j<=K:
        if T[j]=='r':
            ans+=P
        elif T[j]=='s':
            ans+=R
        else:
            ans+=S
    elif j>K and T[j]!=T[j-K]:
        if T[j]=='r':
            ans+=P
        elif T[j]=='s':
            ans+=R
        else:
            ans+=S
    else:
        T[j]=''
print(ans)

Fixed code:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())

ans=0

for j in range(len(T)):
    if j<K:
        if T[j]=='r':
            ans+=P
        elif T[j]=='s':
            ans+=R
        else:
            ans+=S
    elif j>=K and T[j]!=T[j-K]:
        if T[j]=='r':
            ans+=P
        elif T[j]=='s':
            ans+=R
        else:
            ans+=S
    else:
        T[j]=''
print(ans)
Buggy code:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
memo = [""]*N
ans = 0
for i in range(N):
    if i >= K:
        if T[i] == "r":
            if memo[i-K] == "p":
                memo[i] = T[i+K]
            else:
                memo[i] = "p"
                ans += P
        elif T[i] == "s":
            if memo[i-K] == "r":
                memo[i] = T[i+K]
            else:
                memo[i] = "r"
                ans += R
        else:
            if memo[i-K] == "s":
                memo[i] = T[i+K]
            else:
                memo[i] = "s"
                ans += S
    else:
        if T[i] == "r":
            memo[i] = "p"
            ans += P
        elif T[i] == "s":
            memo[i] = "r"
            ans += R
        else:
            memo[i] = "s"
            ans += S
print(ans)



Fixed code:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
memo = [""]*N
ans = 0
for i in range(N):
    if i >= K:
        if T[i] == "r":
            if memo[i-K] == "p":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "p"
                ans += P
        elif T[i] == "s":
            if memo[i-K] == "r":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "r"
                ans += R
        else:
            if memo[i-K] == "s":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "s"
                ans += S
    else:
        if T[i] == "r":
            memo[i] = "p"
            ans += P
        elif T[i] == "s":
            memo[i] = "r"
            ans += R
        else:
            memo[i] = "s"
            ans += S
print(ans)
Buggy code:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().strip().split())
    T = input().strip()

    i = 0
    score = 0
    while i != K:
        before = ""
        print(T[i::K])
        for c in T[i::K]:
            #print(c, before)
            if c != before:
                if c == 'r':
                    score += P
                elif c == 's':
                    score += R
                else:
                    score += S
                before = c
            else:
                before = ""
                #print("?")
        i += 1
    print(score)
if __name__ == '__main__':
    main()


Fixed code:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().strip().split())
    T = input().strip()

    i = 0
    score = 0
    while i != K:
        before = ""
        #print(T[i::K])
        for c in T[i::K]:
            #print(c, before)
            if c != before:
                if c == 'r':
                    score += P
                elif c == 's':
                    score += R
                else:
                    score += S
                before = c
            else:
                before = ""
                #print("?")
        i += 1
    print(score)
if __name__ == '__main__':
    main()
Buggy code:
n, k = map(int, input().split())
r, p, s = map(int, input().split())
d = {"r":s, "p":r, "s":p}
t = input()
dp = [0]*n
for i in range(n):
  if i>k and dp[i-k]==d[t[i]]:
    dp[i] = 0
  else:
    dp[i] = d[t[i]]
print(sum(lst))

Fixed code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
d = {"r":p, "s":r, "p":s}
t = list(input())
dp = [0]*n
for i in range(n):
  if i>=k and t[i]==t[i-k]:
    dp[i] = 0
    t[i] = "x"
  else:
    dp[i] = d[t[i]]
print(sum(dp))
Buggy code:
N,K = map(int, input().split())
R,S,P = map(int, input().split())
T = list(input())


def subtotal(sub_T):
    #dp[hand, sub_total_point]
    dp = [['non', 0]]
    sub_total_point = 0

    for i in range(0,len(sub_T)):
        hand = sub_T[i]
        print(str(i)+ ':' + sub_T[i])
        if hand != dp[i][0]:
            if hand == 'r':
                sub_total_point += P
            elif hand == 's':
                sub_total_point += R
            elif hand == 'p':
                sub_total_point += S
            else:
                pass

        else:
            hand = 'n'

        dp.append([hand,sub_total_point])

    return sub_total_point

def main():
    total_point = 0

    if K==1:
        total_point += subtotal(T)

    else:
        for m in range(0, K):
            sub_T = []
            for n in range(0, int(N/K)+1):
                if n*K+m < N:
                    sub_T.append(T[n*K+m])
                else:
                    pass

            total_point += subtotal(sub_T)

    print(total_point)

if __name__ == "__main__":
    main()


Fixed code:
N,K = map(int, input().split())
R,S,P = map(int, input().split())
T = list(input())


def subtotal(sub_T):
    #dp[hand, sub_total_point]
    dp = [['non', 0]]
    sub_total_point = 0

    for i in range(0,len(sub_T)):
        hand = sub_T[i]
        if hand != dp[i][0]:
            if hand == 'r':
                sub_total_point += P
            elif hand == 's':
                sub_total_point += R
            elif hand == 'p':
                sub_total_point += S
            else:
                pass

        else:
            hand = 'n'

        dp.append([hand,sub_total_point])

    return sub_total_point

def main():
    total_point = 0

    if K==1:
        total_point += subtotal(T)

    else:
        for m in range(0, K):
            sub_T = []
            for n in range(0, int(N/K)+1):
                if n*K+m < N:
                    sub_T.append(T[n*K+m])
                else:
                    pass

            total_point += subtotal(sub_T)

    print(total_point)

if __name__ == "__main__":
    main()
Buggy code:
def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = input()[:-1].decode()

    ans = 0
    result = [False] * n
    for i in range(n):
        if k <= i and t[i] == t[i - k] and result[i - k]:
            continue
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        elif t[i] == 'p':
            ans += s
        result[i] = True

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Fixed code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = input()[:-1].decode()

    ans = 0
    result = [False] * n
    for i in range(n):
        if k <= i and t[i] == t[i - k] and result[i - k]:
            continue
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        elif t[i] == 'p':
            ans += s
        result[i] = True

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy code:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
score_dic = {"r":R,"s":S,"p":P}
win_dic = {"r":"p","s":"r","p":"s"}
T = list(input())
score = 0
for i in range(0,N,1):
    if i >= K and T[i-K] == T[i]:
        T[i]="m"
        print(0)
    else:
        score+=score_dic[win_dic[T[i]]]
        print(score_dic[T[i]])

print(score)

Fixed code:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
score_dic = {"r":R,"s":S,"p":P}
win_dic = {"r":"p","s":"r","p":"s"}
T = list(input())
score = 0
for i in range(0,N,1):
    if i >= K and T[i-K] == T[i]:
        T[i]="m"
    else:
        score+=score_dic[win_dic[T[i]]]

print(score)
Buggy code:
import sys
sys.setrecursionlimit(10000)
def conv(r,s,p,j):
    if j == 'r':
        return p
    if j == 's':
        return r
    if j == 'p':
        return s
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def perse(t,k,num):
    stri = []
    point = []
    for i in range(k):
        stri.append([])
        point.append([])
    for i in range(num):
        stri[i%k].append(t[i])
        point[i%k].append(conv(r,s,p,t[i]))
    return stri,point
def main(q,r,s,p):
    if len(q) == 1:
        return point[0]
    if len(q) == 0:
        return 0
    if q[0] != q[1]:
        return main(q[1:],point[1:]) + point[0]
    else:
        return main(q[2:],point[2:]) + point[0]
num,k = listint()
r,s,p = listint()
t = input()
afterperse,point = perse(t,k,num)
ans = 0
for i in range(k):
    ans = ans + main(afterperse[i],point)
print(ans)

Fixed code:
import sys
sys.setrecursionlimit(10000)
def conv(r,s,p,j):
    if j == 'r':
        return p
    if j == 's':
        return r
    if j == 'p':
        return s
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def perse(t,k,num):
    stri = []
    for i in range(k):
        stri.append([])
    for i in range(num):
        stri[i%k].append(t[i])
    return stri
def main(q):
    i = 0
    ans = 0
    while i < len(q)-1:
        if q[i] == q[i+1]:
            ans = ans + conv(r,s,p,q[i])
            i = i+2
        else:
            ans = ans + conv(r,s,p,q[i])
            i = i+1
    if i == len(q)-1:
        ans = ans + conv(r,s,p,q[i])
    return ans
num,k = listint()
r,s,p = listint()
t = input()
afterperse = perse(t,k,num)
ans = 0
for i in range(k):
    ans = ans + main(afterperse[i])
print(ans)
Buggy code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0

def get_score(c):
    if c == 's':
        score = r
    elif c == 'p':
        score = s
    else:
        score = p
    return score

for i in range(n):
    c = t[i]
    if i < k:
        ans += get_score(c)
    else:
        if c == t[i-k]:
            if c != t[i-2*k]:
                ans += get_score(c)
        else:
            ans += get_score(c)

print(ans)

Fixed code:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
ans = 0

def get_score(c):
    if c == 's':
        score = r
    elif c == 'p':
        score = s
    else:
        score = p
    return score

for i in range(n):
    c = t[i]
    if i < k:
        ans += get_score(c)
    else:
        if c == t[i-k]:
            t[i] = '0'
        else:
            ans += get_score(c)
print(ans)
Buggy code:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x==r:
    c+=P
  elif x==s:
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
print(c)

Fixed code:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i]+"o"+T[i+1:]
print(c)
Buggy code:
def ten(arr,R,S,P):
  ans = 0
  num = 0
  length = len(arr)
  print(length)
  for i in range(length):
    if i == 0:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i

    elif i > 0 and arr[i] != arr[i-1]:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
        
    elif i > 0 and arr[i] == arr[i-1] and int(num+1) != i:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
    
  return ans

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T = input()

T = list(T)
arr = []

for i in range(K):
  a = T[i::K]
  arr.append(a)

ans = 0

for i in arr:
  ans = ans + ten(i,R,S,P)

print(ans)


Fixed code:
def ten(arr,R,S,P):
  ans = 0
  num = 0
  length = len(arr)
  for i in range(length):
    if i == 0:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i

    elif i > 0 and arr[i] != arr[i-1]:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
        
    elif i > 0 and arr[i] == arr[i-1] and int(num+1) != i:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
    
  return ans

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T = input()

T = list(T)
arr = []

for i in range(K):
  a = T[i::K]
  arr.append(a)

ans = 0

for i in arr:
  ans = ans + ten(i,R,S,P)

print(ans)
Buggy code:
n,k=map(int,input().split())
scores=list(map(int,input().split()))
t=input()
winner={'r':2,'s':0,'p':1}
ans=0
for i in range(k):
  ts=''
  for j in range(n):
    if k*j+i>=n:
      break
    ts+=t[k*j+i]
  print(ts)
  ts+='?'
  l=len(ts)
  hand=ts[0]
  cnt=1
  for j in range(1,l):
    if hand==ts[j]:
      cnt+=1
    else:
      ans+=scores[winner[hand]]*((cnt+1)//2)
      hand=ts[j]
      cnt=1
print(ans)

Fixed code:
n,k=map(int,input().split())
scores=list(map(int,input().split()))
t=input()
winner={'r':2,'s':0,'p':1}
ans=0
for i in range(k):
  ts=''
  for j in range(n):
    if k*j+i>=n:
      break
    ts+=t[k*j+i]
  ts+='?'
  l=len(ts)
  hand=ts[0]
  cnt=1
  for j in range(1,l):
    if hand==ts[j]:
      cnt+=1
    else:
      ans+=scores[winner[hand]]*((cnt+1)//2)
      hand=ts[j]
      cnt=1
print(ans)
Buggy code:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
optimal = {'r':'p', 's':'r', 'p':'s'}
point = {'r':R, 's':S, 'p':P}
ans = 0

A = []

for i in range(0, N):
    if i <= K-1:
        A.append(optimal[T[i]])
        ans = ans + point[A[i]]
    elif A[i-K] != optimal[T[i]]:
        A.append(optimal[T[i]])
        ans = ans + point[A[i]]
    elif i + K <= N-1:
        if optimal[T[i]] != 'r' and optimal[T[i+K]] != 'r':
            A.append('s')
        elif optimal[T[i]] != 's' and optimal[T[i+K]] != 's':
            A.append('p')
        else:
            A.append('r')
    else:
        if optimal[T[i]] != 'r':
            A.append('s')
        elif optimal[T[i]] != 's':
            A.append('p')
        else:
            A.append('r')

print(ans)

Fixed code:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
optimal = {'r':'p', 's':'r', 'p':'s'}
point = {'r':R, 's':S, 'p':P}
ans = 0

A = []

for i in range(0, N):
    if i <= K-1:
        A.append(optimal[T[i]])
        ans = ans + point[A[i]]
    elif A[i-K] != optimal[T[i]]:
        A.append(optimal[T[i]])
        ans = ans + point[A[i]]
    elif i + K <= N-1:
        if optimal[T[i]] != 'r' and optimal[T[i+K]] != 'r':
            A.append('r')
        elif optimal[T[i]] != 's' and optimal[T[i+K]] != 's':
            A.append('s')
        else:
            A.append('p')
    else:
        if optimal[T[i]] != 'r':
            A.append('s')
        elif optimal[T[i]] != 's':
            A.append('p')
        else:
            A.append('r')

print(ans)