qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()

n_rainy_day = 0

for i in range(3):
  if S[i] == 'S':
    if n_rainy_day == 0:      
      n_rainy_day += 1
    elif S[i-1] == 'S':
      n_rainy_day += 1
          
print(n_rainy_day)


Fixed code:
S = input()

n_rainy_day = 0

for i in range(3):
  if S[i] == 'R':
    if n_rainy_day == 0:
      n_rainy_day += 1
    elif S[i-1] == 'R':
      n_rainy_day += 1
          
print(n_rainy_day)
Buggy code:
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)





Fixed code:
S = input()
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)
Buggy code:
list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Fixed code:
weather=list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)
Buggy code:
s=input()
arr=[]
for i in s:
    arr.append(i)
brr=[]
count=0
for i in arr:
    if(i=='S'):
        brr.append(count)
    if(i=='R'):
        count=count+1 
brr.append(count)
print(max(brr))

Fixed code:
s=input()
arr=[]
for i in s:
    arr.append(i)
brr=[]
count=0
for i in arr:
    if(i=='S'):
        brr.append(count)
        count=0
    if(i=='R'):
        count=count+1 
brr.append(count)
print(max(brr))
Buggy code:
s = input()
if s == 'RRR':
    print(3)
elif s == 'RRS' or 'SRR':
    print(2)
elif s == 'SSS':
    print(0)
else:
    print(1)


Fixed code:
s = input()

if s == 'RRR':
  print(3)
elif s == 'RRS' or s == 'SRR':
  print(2)
elif s == 'SSS':
  print(0)
else:
  print(1)
Buggy code:
S=input()
ans=0
tmp=0
for s in S:
  if s='S':
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
print(max(ans,tmp))

Fixed code:
S=input()
ans=0
tmp=0
for s in S:
  if s=='R':
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
print(max(ans,tmp))
Buggy code:
x = input()
t = x.count("R")
if t != 3 and x[0] == x[2]:
  t -= 1
print(t)

Fixed code:
x = input()
t = x.count("R")
if t != 3 and x[0] == x[2] and x[0] == "R":
  t -= 1
print(t)
Buggy code:
def solve():
    s = input()
    ans = 0
    hoge = [0]
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
        else:
            ans = 0
    print(min(hoge))
    return 0

if __name__ == "__main__":
    solve()

Fixed code:
def solve():
    s = input()
    ans = 0
    hoge = [0]
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
        else:
            ans = 0
    print(max(hoge))
    return 0

if __name__ == "__main__":
    solve()
Buggy code:
s=input()
gou=0
if s[0]=="R" and s[1]=="R":
  gou=2
if s[1]=="R" and s[2]=="R":
  gou=2
if s[1]=="R" and s[2]=="R" and s[3]=="R":
  gou=3
print(gou)

Fixed code:
s=input()
gou=0
if s[0]=="R" or s[1]=="R" or s[2]=="R":
  gou=1
if s[0]=="R" and s[1]=="R":
  gou=2
if s[1]=="R" and s[2]=="R":
  gou=2
if s[1]=="R" and s[2]=="R" and s[0]=="R":
  gou=3
print(gou)
Buggy code:
S = input()

if S == "RRR":
    print(3)
elif S == "SSS":
    print(0)
elif S[0:2] == "R" or S[1:3] == "R":
    print(2)
else:
    print(1)

Fixed code:
S = input()

if S == "RRR":
    print(3)
elif S == "SSS":
    print(0)
elif S[0:2] == "RR" or S[1:3] == "RR":
    print(2)
else:
    print(1)
Buggy code:
def main():
    s = list(input())
    last = ''
    count = 0
    for i, day in enumerate(s):
        if day == 'S':
            count = 0
        if i == 0:
            count += 1
        elif last == 'R':
            count += 1
        last = day

    print(count)


if __name__ == '__main__':
    main()


Fixed code:
def main():
    s = list(input())
    last = ''
    count = 0
    for i, day in enumerate(s):
        if day == 'S':
            last = day
            continue
        if i == 0:
            count += 1
        elif last == 'R':
            count += 1
        elif last == 'S':
            count = 1
        last = day

    print(count)


if __name__ == '__main__':
    main()
Buggy code:
s=input()

list = list(s)
cnt=0
if list(0) == 'R' and list(1) == 'R' and list(2)=='R':
    print(3)
elif list(0)=='R' and list(1) == 'R'and list(2)!='R':
    print(2)
elif list(0)=='R' and list(1) != 'R'and list(2)!='R':
    print(1)
elif list(0)=='R' and list(1) != 'R'and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)=='R':
    print(2)
elif list(0)!='R' and list(1) != 'R' and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)!='R':
    print(1)
else:
    print(0)

Fixed code:
s=input()

list = list(s)
cnt=0
if list[0] == 'R' and list[1] == 'R' and list[2]=='R':
    print(3)
elif list[0]=='R' and list[1] == 'R'and list[2]!='R':
    print(2)
elif list[0]=='R' and list[1] != 'R'and list[2]!='R':
    print(1)
elif list[0]=='R' and list[1] != 'R'and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]=='R':
    print(2)
elif list[0]!='R' and list[1] != 'R' and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]!='R':
    print(1)
else:
    print(0)
Buggy code:
s=input()
n=0
for i in range(len(s)):
    if s[i]=='S':
        n=0
    else:
        n+=1
print(n)

Fixed code:
s=input()
n=0
m=0
for i in range(len(s)):
    if s[i]=='S':
        n=0
    else:
        n+=1
        m=n
print(m)
Buggy code:
a,b,c = input()
count = 0

if a == "R" and b == "R" and c == "R":
  count = 3
elif (a == "R" and b == "R") or(b == "R" and c == "R"):
  count = 2
elif a == "R"or b =="R" or C == "R":
  count = 1
else:
  count = 0
  
print(count)

Fixed code:
a,b,c = input()
count = 0

if a == "R" and b == "R" and c == "R":
  count = 3
elif (a == "R" and b == "R") or(b == "R" and c == "R"):
  count = 2
elif a == "R"or b =="R" or c == "R":
  count = 1
else:
  count = 0
  
print(count)
Buggy code:
s = input()
if s[0] == s[1] == s[2] == 'R':    
    print(3)
elif s[0] == s[1] == 'R' or s[0] == s[2] == 'R' or s[1] == s[2] == 'R':
    print(2)
elif s[0] == 'R' or s[1] == 'R' or s[2] == 'R':
    print(1)
else:
    print(0)

Fixed code:
s = input()
if s[0] == s[1] == s[2] == 'R':
    print(3)
elif s[0] == s[1] == 'R' or s[1] == s[2] == 'R':
    print(2)
elif s[0] == 'R' or s[1] == 'R' or s[2] == 'R':
    print(1)
else:
    print(0)
Buggy code:
S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc=1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)

Fixed code:
S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc==1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)
Buggy code:
A = input()
b = A.count("RRR")
C = A.count("RR")
D = A.count("R")
if b == 1: 
   print(3)
elif C ==1:
   print(2)
else:
   if D ==1:
      print(1)
   else:
      print(0)

Fixed code:
A = input()
b = A.count("RRR")
C = A.count("RR")
if b == 1: 
   print(3)
elif C ==1:
   print(2)
else:
   if A.count("R")>0:
      print(1)
   else:
      print(0)
Buggy code:
S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(a)

Fixed code:
S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(x)
Buggy code:
S = input()

if S.count('R') == 3:
    print(3)
elif S.count('R') == 2:
    if S[1] == 'S':
        print(1)
    else:
        print(2)
elif S.count('R') == 1:
    print(1)

Fixed code:
S = input()

if S.count('R') == 3:
    print(3)
elif S.count('R') == 2:
    if S[1] == 'S':
        print(1)
    else:
        print(2)
elif S.count('R') == 1:
    print(1)
else:
    print(0)
Buggy code:
s=input()
if s=="SSS":
  print(0)
else if s=="RRS" or s= "SRR":
  print(2)
else if s= "RRR":
  print(3)
else:
  print(1)

Fixed code:
s=input()
if s=="SSS":
  print(0)
elif s=="RRS" or s== "SRR":
  print(2)
elif s== "RRR":
  print(3)
else:
  print(1)
Buggy code:
a = input()
if a == "RRR":
  print(3)
elif a in "RR":
  print(2)
elif a == "SSS":
  print(0)
else:
  print(1)

Fixed code:
a = input()
if a == "RRR":
  print(3)
elif "RR" in a:
  print(2)
elif a == "SSS":
  print(0)
else:
  print(1)
Buggy code:
s = input()
print("3" if "RRR" in s else "2" if "RR" in s else "1" "R" in s else "0" )

Fixed code:
s=input()
if "R" in s:
    if s=="RRR":
        print(3)
    else:
        if "RR" in s:
            print(2)
        else:
            print(1)
else:
    print(0)
Buggy code:
S = input()
a = 0
for i in S:
    if i == 'R':
        a += 1
if a == 2:
    if S[1] == S:
        a == 1
print(a)

Fixed code:
S = list(input())
a = 0
for i in S:
    if i == 'R':
        a += 1
if a == 2:
    if S[1] == 'S':
        a = 1
print(a)
Buggy code:
day=input()
resMax=0
resTemp=0
for i in range(len(day)):
  if day[i]=='S':
    resTemp=0
  elif day[i]=='R':
    while(day[i]!='S'):
      resTemp+=1
      i+=1
  if resMax<resTemp:
    resMax=resTemp
print(resMax)
    

Fixed code:
day = input()
resMax = 0
resTemp = 0
for i in range(len(day)):
  if day[i]=='S':
    resTemp=0
  elif day[i]=='R':
    resTemp=0
    while (i<len(day)) and (day[i]!='S'):
      resTemp+=1
      i+=1
    if resTemp>resMax:
      resMax=resTemp
print(resMax)
Buggy code:
s=input()
if ("RRR" in s):
  print(3)
elif ("RR" in s):
  print(2)
elif ("R" in s):
  print(3)
else:
  print(0)


Fixed code:
s=input()
if ("RRR" in s):
  print(3)
elif ("RR" in s):
  print(2)
elif ("R" in s):
  print(1)
else:
  print(0)
Buggy code:
s = input()

if 'RRR' in s:
    ans = 3
elif 'RR' in s:
    ans = 2
elif 'R' in s:
    ans = 1
print(ans)

Fixed code:
s = input()
ans = 0
if 'RRR' in s:
    ans = 3
elif 'RR' in s:
    ans = 2
elif 'R' in s:
    ans = 1
print(ans)
Buggy code:
s = input()

Rnum=s.count('R')
ans=0
if Rnum==3:
    ans=3
elif Rnum==0:
    ans=0
elif Rnum==2 and s!='RSR':
    ans=2
elif Rnum==1:
    ans=1

print(ans)

Fixed code:
s = input()

Rnum=s.count('R')
ans=1
if Rnum==3:
    ans=3
elif Rnum==0:
    ans=0
elif Rnum==2 and s!='RSR':
    ans=2
elif Rnum==1:
    ans=1

print(ans)
Buggy code:
s = input()
ans = 0

for i in range(1,4):
  p = "R"*i
  if p in s:
    ans = i
print(i+1)

Fixed code:
s = input()
ans = 0

for i in range(1,4):
  p = "R"*i
  if p in s:
    ans = i
    
print(ans)
Buggy code:
s = str(input())
ans = 0
if(s[0]=="R"):
  if(s[1]=="R"):
    if(s[2]=="R"):
      ans = 3
    else:
      ans = 2
  else:
    ans = 1
else:
  if(s[1]=="R"):
    if(s[2]=="R"):
      ans = 2
    else:
      ans = 1
  else:
    ans = 0

Fixed code:
s = str(input())
ans = 0
if(s[0]=="R"):
  if(s[1]=="R"):
    if(s[2]=="R"):
      ans = 3
    else:
      ans = 2
  else:
    ans = 1
else:
  if(s[1]=="R"):
    if(s[2]=="R"):
      ans = 2
    else:
      ans = 1
  else:
    if(s[2]=="R"):
      ans = 1
    else:
      ans = 0
print(ans)
Buggy code:
a=list(input())
cnt=0
ans=0
for i in a:
  if i=="R":
    cnt+=1
  else:
    ans=max(cnt,ans)
    cnt=0
print(cnt)

Fixed code:
a=list(input())
cnt=0
ans=0
for i in a:
  if i=="R":
    cnt+=1
  else:
    ans=max(cnt,ans)
    cnt=0
ans=max(cnt,ans)
print(ans)
Buggy code:
S=input()
if S[1]=="R":
  if S[2]=="R":
    if S[3]=="R":
      print(3)
    else:
      print(2)
  else:
    print(1)
elif S[2]=="R":
  if S[3]=="R":
    print(2)
  else:
    print(1)
elif S[3]=="R":
  print(1)
else:
  print(0)

Fixed code:
S=input()
if S[1-1]=='R':
  if S[2-1]=='R':
    if S[3-1]=='R':
      print(3)
    else:
      print(2)
  else:
    print(1)
elif S[2-1]=='R':
  if S[3-1]=='R':
    print(2)
  else:
    print(1)
elif S[3-1]=='R':
  print(1)
else:
  print(0)
Buggy code:
S = input()
cnt = 0

for i in S:
    if i == 'R':
        cnt += 1
        cnt_max = cnt
    else:
        
        cnt = 0
print(cnt_max)

Fixed code:
S = input()
cnt = 0
cnt_max = 0

for i in S:
    if i == 'R':
        cnt += 1
        cnt_max = cnt
    else:
        
        cnt = 0
print(cnt_max)
Buggy code:
a = str(input())

if a[0] == 'R' and a[1] == 'R' and a[2] == 'R':
  print(3)
elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2)
elif a[0] == 'R' and a[1] == 'R' and a[0] != 'R':
  print(2)
elif 'R' not in a:
  print(0)
else:
  print(1)

Fixed code:
a = str(input())

if a[0] == 'R' and a[1] == 'R' and a[2] == 'R':
  print(3)
elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2)
elif a[0] == 'R' and a[1] == 'R' and a[2] != 'R':
  print(2)
elif 'R' not in a:
  print(0)
else:
  print(1)
Buggy code:
S = list(input())
RD = S.count('R')
if RD != 2:
    print(RD)
else:
    if S[1] == 'R':
        print(RD and 'bbb')
    else:
        print(1)


Fixed code:
S = list(input())
RD = S.count('R')
if RD != 2:
    print(RD)
else:
    if S[1] == 'R':
        print(RD)
    else:
        print(1)
Buggy code:
S = int(input())

flag = False
ans = 0
for i in range(len(S)):
    if S[i] == 'R':
        ans += 1
        flag = True
    elif S[i] == 'S' ans flag:
        break

print(ans)


Fixed code:
S = input()

flag = False
ans = 0
for i in range(len(S)):
    if S[i] == 'R':
        ans += 1
        flag = True
    elif S[i] == 'S' and flag:
        break

print(ans)
Buggy code:
inn = input()
numS = 0
for c in inn:
    if c == 'R':
        numS += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2);

Fixed code:
inn = input()
numR = 0
for c in inn:
    if c == 'R':
        numR += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2)
Buggy code:
cnt = 0
t = list(input())
for i in range(len(t)):
    if "R" * i in t:
        cnt = i + 1
print(cnt)

Fixed code:
cnt = 0
t = input()
for i in range(len(t)):
    if "R" * (i + 1) in t:

        cnt = i + 1
print(cnt)
Buggy code:
a, b, c = input()

if b == "R":
  d = 1
  if a == "R":
    d += 1
  if c == "R":
  	d += 1
else:
  d = 0
  if a == "R" or c == "R":
    d += 1
 
print(c)

Fixed code:
a, b, c = input()

if b == "R":
  d = 1
  if a == "R":
    d += 1
  if c == "R":
  	d += 1
else:
  d = 0
  if a == "R" or c == "R":
    d += 1
 
print(d)
Buggy code:
D = list(input().strip().split())
ans = 0
ans_list = []
if D.count("R") >= 1:
  for i in range(3):
    if D[i] == 'R':
      ans += 1
      ans_list.append(ans)
    elif D[i] == 'S':
      ss = 0
      ans_list.append(ss)
  print(max(ans_list))
elif D.count("R") < 1:
  print(0)


Fixed code:
D = input()
ans = 0
ans_list = []
if D.count("R") >= 1:
  for i in range(3):
    if D[i] == 'R':
      ans += 1
      ans_list.append(ans)
    elif D[i] == 'S':
      ss = 0
      ans_list.append(ss)
      if i > 0:
        ans = 0
  print(max(ans_list))
elif D.count("R") < 1:
  print(0)
Buggy code:
str1=input()
ct=0
for i in range(0,3):
  if(str1[i]=='S')
  ct+=1
if(ct==0):
  print(3)
if(ct==3):
  print(0)
if(ct==2):
  print(1)
if(ct==1):
  if(str1[1]=='S'):
    print(1)
  else:
    print(2)

Fixed code:
str1=input()
ct=0
for i in range(0,3):
    if(str1[i]=='S'):
        ct+=1
if(ct==0):
    print(3)
if(ct==3):
    print(0)
if(ct==2):
    print(1)
if(ct==1):
    if(str1[1]=='S'):
        print(1)
    else:
        print(2)
Buggy code:
N = list(input())
if N[0] == 'R' and N[1] == 'R' and N[2] == 'R':
    print(3)
elif N[0] == 'R' and N[1] == 'R' and N[2] == 'S':
    print(2)
elif N[0] == 'S' and N[1] == 'R' and N[2] == 'R':
    print(2)
else:
    print(0)


Fixed code:
a=list(input())
if a[0]=="R":
  if a[1]=="S":
    print(1)
  else:
    if a[2]=="R":
      print(3)
    else:
      print(2)
else:
  if a[1]=="R" and a[2]=="R":
    print(2)
  elif a[1]=="S" and a[2]=="S":
    print(0)
  else:
    print(1)
Buggy code:
s = input()

if s == 'RRR':
  print(3)
elif s == 'RRS' or 'SRR':
  print(2)
elif s == 'SSS':
  print(0)
else:
  print(1)

Fixed code:
s = input()
 
if s == 'RRR':
  print(3)
elif s == 'RRS' or s == 'SRR':
  print(2)
elif s == 'SSS':
  print(0)
else:
  print(1)
Buggy code:
s = 'S'
r = 'R'

x = input()
unko = list(x)
count = 0
for i in unko:
    if i == 'R':
        count = count + 1
print(count)


Fixed code:
s = 'S'
r = 'R'

x = input()
unko = list(x)
count = 0
for i in unko:
    if i == 'R':
        count = count + 1
if x == 'RSR':
    count = 1
print(count)
Buggy code:
s = input()

if s == "SSS":
    print(0)
elif s == ("RSS" or "SRS" or "SSR" or "RSR"):
    print(1)
elif s == ('RRS' or 'SRR'):
    print(2)
elif s == "RRR":
    print(3)

# if s.count("R") == 0:
#     print(0)
# elif s.count("R") == 1 or s == "RSR":
#     print(1)
# elif s.count("R") == 2:
#     print(2)
# elif s.count("R") == 3:
#     print(3)


Fixed code:
s = input()

#if s == "SSS":
    #print(0)
#elif s == "RSS" or "SRS" or "SSR" or "RSR":
    #print(1)
#elif s == 'RRS' or 'SRR':
    #print(2)
#elif s == "RRR":
    #print(3)

if s.count("R") == 0:
    print(0)
elif s.count("R") == 1 or s == "RSR":
    print(1)
elif s.count("R") == 2:
    print(2)
elif s.count("R") == 3:
    print(3)
Buggy code:
S = input()
count = 0
if S == 'RSR':
  print(1)
else:
  for i in S:
    if i == 'R':
      cout+=1
  print(count)

Fixed code:
S = input()
count = 0
if S == 'RSR':
  print(1)
else:
  for i in S:
    if i == 'R':
      count+=1
  print(count)
Buggy code:
s=input()
n=len(s)
li=[]
c=0
for i in range(n):
	if(s[i]=='R'):
		c=c+1
    else:
		li.append(c)
		c=0
li.append(c)
print(max(li))

Fixed code:
s=input()
n=len(s)
c=0
li=[]
for i in range(n):
  if(s[i]=='R'):
    c=c+1
  else:
    li.append(c)
    c=0
li.append(c)
print(max(li))
Buggy code:
s=input()
c=0
mc=0
for i in s:
  if i='R':
    c+=1
    mc=c
  else:
    c=0
print(max(c,mc))

Fixed code:
s=input()
a=0
c=0
for i in s:
	if i=='R':
		c+=1
	else:
		c=0
	a=max(a,c)
print(a)
Buggy code:
s = str(input())
if s == "RRR":
    print(3)
elif s == "SRR" or s == "RRS":
    print(2)
elif s == "SSS":
    print(1)
else:
    print(0)

Fixed code:
s=input()

if s=="RRR":
    print(3)
elif s=="SSS":
    print(0)
elif s=="RRS" or s=="SRR":
    print(2)
else:
    print(1)
Buggy code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    return

if __name__=='__main__':
    s = S()
    for rep in s:
        if rep=="RRR":
            print(3)
        elif rep=="RRS" or "SRR":
            print(2)
        elif rep=="SSS":
            print(0)
        else:
            print(1)
    solve()

Fixed code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    return

if __name__=='__main__':
    s = S()
    if s=="RRR":
        print(3)
    elif s=="RRS" or s=="SRR":
        print(2)
    elif s=="SSS":
        print(0)
    else:
        print(1)
    solve()
Buggy code:
W = input()
ans = 0
count = 0
for i in range(len(W)):
  if W[i] == R:
    count += 1
    ans = max(ans,count)
  else:
    count = 0
print(ans)

Fixed code:
W = input()
ans = 0
count = 0
for i in range(len(W)):
  if W[i] == "R":
    count += 1
    ans = max(ans,count)
  else:
    count = 0
print(ans)
Buggy code:
S = input()
a = 0
for i in range(3):
  if S[i]=="R":
    a+=1
    if S[i]=="S" and a>0:
      break
      print(a)

Fixed code:
S = input()
a = 0
for i in range(3):
  if S[i]=="R":
    a+=1
  if S[i]=="S" and a>0:
      break
print(a)
Buggy code:
S = input()

l = len(S)
count = 0

for i in range(l):
    cur_count = 1

    for j in range(i+1,l):
        if S[i] == "S":
            break
        if (S[i] != S[j]):
            break
        cur_count += 1
    if cur_count > count:
        count = cur_count

print(count)

Fixed code:
S = input()

l = len(S)
count = 0

for i in range(l):
    if "R" not in S:
        break
    cur_count = 1

    for j in range(i+1,l):
        if S[i] == "S":
            break
        if (S[i] != S[j]):
            break
        cur_count += 1
    if cur_count > count:
        count = cur_count

print(count)
Buggy code:
# a,b = map(int, input().split())
s = input()
c = s.count("R")

if c == 1:
    print(c)
elif c == 2:
    if s[0] == s[1]:
        print(c)
    elif s[1] == s[2]:
        print(c)
    else:
        print(1)
elif c == 3:
    print(3)

Fixed code:
# a,b = map(int, input().split())
s = input()
c = s.count("R")

if c == 1:
    print(c)
elif c == 2:
    if s[0] == s[1]:
        print(c)
    elif s[1] == s[2]:
        print(c)
    else:
        print(1)
elif c == 3:
    print(3)
elif c == 0:
    print(0)
Buggy code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

s = input()
cnt = 0
ans = 0
for i in s:
    if i=='R':
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
print(cnt)

Fixed code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

s = input()
cnt = 0
ans = 0
for i in s:
    if i=='R':
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
print(max(ans,cnt))
Buggy code:
s = list(input())

if s[0]=='R':
  if s[1]=='R':
    if s[2]=='R':
      print(3)
      exit()
    else:
      print(2)
      exit()
  else:
    print(1)
    exit()
else:
  if s[1]=='R':
    if s[2]=='R':
      print(2)
      exit()
    else:
      print(1)
      exit()
  else:
    print(1)
    exit()
print(0)

Fixed code:
s = list(input())

if s[0]=='R':
  if s[1]=='R':
    if s[2]=='R':
      print(3)
      exit()
    else:
      print(2)
      exit()
  else:
    print(1)
    exit()
else:
  if s[1]=='R':
    if s[2]=='R':
      print(2)
      exit()
    else:
      print(1)
      exit()
  else:
    if s[2]=='R':
      print(1)
      exit()
    else:
      print(0)
Buggy code:
s=input()
if s=='RRR':
  print(3)
elif s=='RRs'or s=='SRR':
  print(2)
elif s=='SSS':
  print(0)
else:
  print(1)

Fixed code:
s=input()
if s=='RRR':
  print(3)
elif s=='RRS'or s=='SRR':
  print(2)
elif s=='SSS':
  print(0)
else:
  print(1)
Buggy code:
S = list(input())
X = 0
if S[1] == "R":
    if S[0] == S[1] or S[1] == S[2]:
        if S[0] == "R" and S[2] == "R":
            X = 2
        else:
            X = 1
print(X)

Fixed code:
S = list(input())
X = 0
if S[1] == "R":
    if S[0] == S[1] or S[1] == S[2]:
        if S[0] == "R" and S[2] == "R":
            X = 3
        else:
            X = 2
    else:
        X=1
elif S[0] == "R" or S[2] =="R":
    X = 1
print(X)
Buggy code:
x = input()
ans = 0
mx = 0
for l in x:
  if l=='R':
    ans+=1
  elif ans>1:
    ans-=1
  if ans>mx:
    mx = ans
print(mx)

Fixed code:
x = input()
ans = 0
mx = 0
for l in x:
  if l=='R':
    ans+=1
  elif ans>0:
    ans-=1
  if ans>mx:
    mx = ans
print(mx)
Buggy code:
a=input()
flag=False
ans=0
hold=0
for i in range(3):
    if a[i]=='R' and not flag:
        ans=1
        flag=not flag
        hold=max(hold,ans)

    elif a[i]=='R' and flag:
        ans+=1
        hold=max(hold,ans)

    else:
        ans=0
        flag=False


return(hold)


Fixed code:
a=input()
flag=False
ans=0
hold=0
for i in range(3):
    if a[i]=='R' and not flag:
        ans=1
        flag=not flag
        hold=max(hold,ans)

    elif a[i]=='R' and flag:
        ans+=1
        hold=max(hold,ans)

    else:
        ans=0
        flag=False


print(hold)
Buggy code:
a = list(str(input()))
cnt=0

if a[0]=="R":
    cnt+=1
if a[1]=="R":
    cnt+=1
if a[2]=="R":
    cnt+=1


print(cnt)

Fixed code:
a = list(str(input()))
cnt=0

if a[0]=="R":
    cnt+=1
    if a[1]=="R":
        cnt+=1
        if a[2]=="R":
            cnt+=1
elif a[1]=="R":
    cnt+=1
    if a[2]=="R":
        cnt+=1
elif a[2]=="R":
    cnt+=1


print(cnt)
Buggy code:
a = input()
if a[0] == "R":
    if a[1] == "R":
        if a[2] == "R":
            print("3")
        else:
            print("2")
    else:
        print("0")
elif a[1] == "R":
    if a[2] == "R":
        print("2")
    else:
        print("0")
else:
    print("0")

Fixed code:
a = input()
if a[0] == "R":
    if a[1] == "R":
        if a[2] == "R":
            print("3")
        else:
            print("2")
    else:
        print("1")
elif a[1] == "R":
    if a[2] == "R":
        print("2")
    else:
        print("1")
elif a[2] == "R":
    print("1")
else:
    print("0")