qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s = input().split('S')

ans = 0

for i in s:
  if len(s) > ans:
    ans = len(s)
    
print(ans)

Fixed code:
s = input().split('S')

ans = 0

for i in s:
  if len(i) > ans:
    ans = len(i)
    
print(ans)
Buggy code:
s = input()

m = 0
cnt = 0
for i in range(3):
    if s[i] == 'r':
        cnt += 1
    else:
        m = max(m, cnt)
        cnt = 0

print(max(m, cnt))

Fixed code:
s = input()

m = 0
cnt = 0
for i in range(3):
    if s[i] == 'R':
        cnt += 1
    else:
        m = max(m, cnt)
        cnt = 0

print(max(m, cnt))
Buggy code:
# -*- coding: utf-8 -*-

def main():
    s = str(input())

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

if __name__ == '__main__':
    main()


Fixed code:
# -*- coding: utf-8 -*-

def main():
    s = str(input())

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

if __name__ == '__main__':
    main()
Buggy code:
s=input()
if s=='RRR':
    print(3)
elif s=='SRR' or 'RRS':
    print(2)
elif s=='SSS':
    print(0)
else:
    print(1)       
    

Fixed code:
s = input().strip()
if s == 'RRR':
    print(3)
elif s == 'RRS' or s == 'SRR':
    print(2)
elif s == 'SSS':
    print(0)
else:
    print(1)
Buggy code:
s = str(input())
if s=='RRR':
    print(3)
elif s=='SRR' or s=='RRS':
    print(2)
elif s=='SSS':
    print(0)
else:
    print(0)

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

Fixed code:
s = input()
s = list(s)

streak = 0
max_streak = 0
for i in s:
  if i == "R":
    streak += 1
    max_streak = max(max_streak, streak)
  else:
    streak = 0
print(max_streak)
Buggy code:
import math

n=0
result=0
k=input()

for i in range(len(k)):
    if k[i]=="R":
        n+=1
    else:
        result=max(result,n)
result=max(result,n)
print(result)

Fixed code:
import math

n=0
result=0
k=input()

for i in range(len(k)):
    if k[i]=="R":
        n+=1
    else:
        result=max(result,n)
        n=0
result=max(result,n)
print(result)
Buggy code:
N=input()
X=0
Y=0
for i+1 in range(len(N)):
  if N[i]="R":
    X+=1
  else:
    Y=X
    X=0
print(max(X,Y))
  

Fixed code:
N=input()
X=0
Y=0
for i in range(len(N)):
  if N[i]=="R":
    X+=1
  else:
    Y=max([X,Y])
    X=0
print(max([X,Y]))
Buggy code:
s= input()
k='S'
count=0
for i in s:
  if k=='R' and i=='R':
    count+=1
    k='R'
  elif k=='S' and i=='R':
    count=1
    k='R'
print(count)

Fixed code:
s= input()
k='S'
count=0
for i in s:
  if k=='R' and i=='R':
    count+=1
    k='R'
  elif k=='S' and i=='R':
    count=1
    k='R'
  elif i=='S':
    k='S'
print(count)
Buggy code:
S  = input()
m = 0
c = 0
for s in S:
  if s == 'S':
    c += 1
  else:
    c == 0
  m = max(m, c)
print(m)

Fixed code:
S  = input()
m = 0
c = 0
for s in S:
  if s == 'R':
    c += 1
  else:
    c = 0
  m = max(m, c)
print(m)
Buggy code:
a = input(str)

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

Fixed code:
a = input()

if a[0]=='R' and a[1]=='R' and a[2]=='R':
  res = 3
elif  a[0]=='R' and a[1]=='R':
  res = 2
elif  a[1]=='R' and a[2]=='R':
  res = 2  
elif  a[0]=='R':
  res = 1
elif  a[1]=='R':
  res = 1
elif  a[2]=='R':
  res = 1 
else:
  res = 0

res = int(res)
print(res)
Buggy code:
S = input()

if S.count("R") == 2 and S[1] != R:
  print(1)
  
else:
  print(S.count("R"))

Fixed code:
S = input()
 
if S.count("R") == 2 and S[1] != "R":
  print(1)
  
else:
  print(S.count("R"))
Buggy code:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	s=RD()
	ans=0
	if s=="RRR":
		ans=3
	elif s=="SSS":
		ans=0
	elif s=="RRS" or "SRR":
		ans=2
	else:
		ans=1
	print(ans)




if __name__ == "__main__":
	main()


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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	s=RD()
	ans=0
	if s=="RRR":
		ans=3
	elif s=="SSS":
		ans=0
	elif s=="RRS" or s=="SRR":
		ans=2
	else:
		ans=1
	print(ans)




if __name__ == "__main__":
	main()
Buggy code:
S = input()
cnt = 0
for i in range(len(S)):
    if S[i] == 'R':
        cnt += 1
    else:
        cnt = 0
print(cnt)

Fixed code:
S = input()
cnt = 0
M = 0
for i in range(len(S)):
    if S[i] == 'R':
        cnt += 1
    else:
        cnt = 0
    if cnt > M:
        M = cnt
print(M)
Buggy code:
Word=input()
Word_list=list(Word)

number=0
renzoku=0

for num in range(3):
  if Word_list[num]="R":
    number=number+1
  else:
    if(number>renzoku):
      renzoku=number
    number=0

Fixed code:
Word=input()
Word_list=list(Word)
 
number=0
renzoku=0
Enter=0
 
for num in range(3):
  if Word_list[num]=="R":
    number=number+1
  if (number>renzoku):
      renzoku=number
  else:
    number=0

print(renzoku)
Buggy code:
s = input()

def A():
  if s == 'RRR':
    return 3
  if s == 'RRS' or s == 'SRR':
    return 2
  return 1

print(A())

Fixed code:
s = input()
 
def A():
  if s == 'RRR':
    return 3
  if s == 'RRS' or s == 'SRR':
    return 2
  if s == 'SSS':
    return 0
  return 1
 
print(A())
Buggy code:
S = input()
max_count = 0
counter = 0
for i in S:
  if i == 'S':
    if max_counter < counter:
      max_count = counter
      counter = 0
  elif i == 'R':
    counter += 1

if max_counter < counter:
  max_count = counter

print(max_counter)


Fixed code:
S = input()
max_count = 0
counter = 0
for i in S:
  if i == 'S':
    if max_count < counter:
      max_count = counter
      counter = 0
  elif i == 'R':
    counter += 1

if max_count < counter:
  max_count = counter

print(max_count)
Buggy code:
S = str(input())


if S=="RRR":
	print(3)
elif S=="RRS" or S=="SRR":
	print(2)
else:
	print(1)


# 2darray [[0] * 4 for i in range(3)]
# import itertools

Fixed code:
S = str(input())


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


# 2darray [[0] * 4 for i in range(3)]
# import itertools
Buggy code:
    text = input()
    if text[1] == "S":
        if text[0] == "R" or text[2] == "R":
            print(1)
        else:
            print(0)
    else:
        if text[0] == "R" and text[2] == "R":
            print(3)
        elif text[0] == "R" or text[2] == "R":
            print(2)

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

Fixed code:
s=input()
if s=='RRR':
  print(3)
elif s=='SSS':
  print(0)
elif (s=='SRR' or s=='RRS'):
  print(2)
else:
  print(1)
Buggy code:
s = input()
cnt = 0
if s[0] == s[1] and s[1] == s[2] and s[1] =='R':
    print('3')
elif s[0] == s[1] or s[1] == s[2] and s[1]=='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] and s[1] == s[2] and s[1] =='R':
    print('3')
elif (s[0] == s[1] or s[1] == s[2]) and s[1]=='R':
    print('2')
elif s[0] == 'R' or s[1] =='R' or s[2] == 'R':
    print('1')
else:
    print('0')
Buggy code:
s = input()
cnt = 0
ans = []
for i in range(3):
  if s[i] == 'R':
    cnt+=1
    ans.append(cnt)
  else:
    cnt = 0
print(max(ans))

Fixed code:
s = input()
cnt = 0
ans = [0]
for i in range(3):
  if s[i] == 'R':
    cnt+=1
    ans.append(cnt)
  else:
    cnt = 0
print(max(ans))
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 = input()
if s[0] == s[1] and s[1] == s[2] and s[1] =='R':
    print('3')
elif s[0] == s[1] or s[1] == s[2] and s[1]=='R':
    print('2')
elif s[0] == 'R' or s[1] =='R' or s[2] == 'R':
    print('1')
else:
    print('0')

Fixed code:
s = str(input())
if s[0]=='R' and s[1]=='R' and s[2]=='R':
    print(3)
elif (s[0]=='R' and s[1]=='R') or (s[1]=='R' and s[2]=='R'):
    print(2)
elif s[0]=='S' and s[1]=='S' and s[2]=='S':
    print(0)
else:
    print(1)
Buggy code:
inp = input()
count=0
res=0
for ch in inp:
  if ch=="R":
    count+=1
  else:
    res=max(res,count)
    count=0
print(count)


Fixed code:
inp =input()
count=0 
res=0 
for ch in inp: 
  if ch=="R": 
    count+=1 
    res = max(res,count) 
  else: 
    res=max(res,count) 
    count=0 
print(res)
Buggy code:
S = input()
ans = 0
for s in range(len(S)):
	if S[s]=="R":
		ans +=1

if ans == 3:
    print(3)
elif ans == 1:
    print(1)
else:
    if S[1] == "S":
        print(1)
    else:
        print(2)

Fixed code:
S = input()
ans = 0
for s in range(len(S)):
	if S[s]=="R":
		ans += 1

if ans == 3:
    print(3)
elif ans == 1:
    print(1)
elif ans == 0:
    print(0)
else:
    if S[1] == "S":
        print(1)
    else:
        print(2)
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=='SSS':
  print(0)
elif s=='RRS' or s=='SRR':
  print(2)
else:
  print(1)
Buggy code:
S = input()
count = 0
if S[0] == 'R':
  if S[1] == 'R':
    if S[2] == 'R':
      	print(3)
  	else:
    	print(2)
  else:
    if S[2] == 'R':
      print(1)
else:
  if S[1] == 'R':
    if S[2] == 'R':
      print(2)
    else:
      print(1)
  else:
    if S[2] == 'R':
      print(1)
    else:
      print(0)

Fixed code:
S = input()
if S[0] == 'R':
    if S[1] == 'R':
        if S[2] == 'R':
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if S[1] == 'R':
        if S[2] == 'R':
              print(2)
        else:
              print(1)
    else:
        if S[2] == 'R':
              print(1)
        else:
              print(0)
Buggy code:
import sys, math


if(__name__ == "__main__"):
    SSS =  input()
    if(SSS=="RRR" ):
        print(3)
    elif("RR" in SSS):
        print(2)
    else:
        print(1)


Fixed code:
import sys, math


if(__name__ == "__main__"):
    SSS =  input()
    if(SSS=="RRR" ):
        print(3)
    elif("RR" in SSS):
        print(2)
    elif("R" in SSS):
        print(1)
    else:
        print(0)
Buggy code:
S = input()
print(max([len(i) for i in S.split("R")]))

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

Fixed code:
s=input()
if s == 'RRR':
  print(3)
elif 'RR' in s:
  print(2)
elif 'R' in s:
  print(1)
else:
  print(0)
Buggy code:
import sys
input = sys.stdin.readline

s = input()
if s[1] == 'R':
    print(s.count('R'))
else:
    if s[0] == 'R' and s[2] == 'R':
        print(2)
    elif s[0] == 'S' and s[2] == 'S':
        print(0)
    else:
        print(1)

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

s = input()
if s[1] == 'R':
    print(s.count('R'))
else:
    if s[0] == 'S' and s[2] == 'S':
        print(0)
    else:
        print(1)
Buggy code:
S = input('').split()

if 'RRR' in S:
    print("3")
elif 'RR' in S:
    print("2")
elif 'R' in S:
    print("1")
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();s.count('R')-(s=="RSR")

Fixed code:
s=input();print(s.count('R')-(s=="RSR"))
Buggy code:
S = list(input())

if "S" in S:
    if S[1] == "S" and (S[0] != "S" or S[2] != "S"):
        print(1)
    elif S[0] == "S" and S[1] == "S" and S[2] == "S":
        print(0)
    elif S[1] == "R" and (S[0] != "R" or S[2] != "R"):
        print(1)
    else:
        print(2)
else:
    print(3)

Fixed code:
S = list(input())

if "S" in S:
    if S[1] == "S" and (S[0] != "S" or S[2] != "S"):
        print(1)
    elif S[0] == "S" and S[1] == "S" and S[2] == "S":
        print(0)
    elif S[1] == "R" and S[0] != "R" and S[2] != "R":
        print(1)
    else:
        print(2)
else:
    print(3)
Buggy code:
def main():
    s = input()
    c = 0
    if s[0] == s[1] == s[2] == "R":
            print(3)
        return
    if s[0] == s[1] == "R" or s[1] == s[2] == "R":
        print(2)
        return
    if s[0] == s[1] == s[2] == "S":
        print(0)
        return

    print(1)
    return

main()



Fixed code:
def main():
    s = input()
    c = 0
    if s[0] == s[1] == s[2] == "R":
        print(3)
        return
    if s[0] == s[1] == "R" or s[1] == s[2] == "R":
        print(2)
        return
    if s[0] == s[1] == s[2] == "S":
        print(0)
        return

    print(1)
    return

main()
Buggy code:
str = str(input())
print(str)
if str == "RRR":
  print(3)
elif str == "RRS" or str=="SRR":
  print(2)
elif str == "SSS":
  print(0)
else:
  print(1)




Fixed code:
str = str(input())
if str == "RRR":
  print(3)
elif str == "RRS" or str=="SRR":
  print(2)
elif str == "SSS":
  print(0)
else:
  print(1)
Buggy code:
S = input()

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

Fixed code:
S = input()

if S =="SSS":
  print(0)
elif S[1] == "S":
  print(1)
elif S == "SRS":
  print(1)
elif S == "RRR":
  print(3)
else:
  print(2)
Buggy code:
a=input()
if a.count("RRR") == 1:
    print(3)
elif a.count("RR") == 1:
    print(2)
elif a.count("R") == 1:
    print(1)
else:
    print(0)

Fixed code:
a=input()
if a.count("RRR") == 1:
    print(3)
elif a.count("RR") == 1:
    print(2)
elif a.count("R") >= 1:
    print(1)
else:
    print(0)
Buggy code:
input_line = input()
#print(input_line)
charlist = list(input_line)
index = 0
for i in range(3):
    if(charlist[i]=="R"):
        index += 1
    
if index==2:
    if charlist[1]=="S":
        print(1)
        
else:
    print(index)

Fixed code:
input_line = input()
#print(input_line)
charlist = list(input_line)
index = 0
for i in range(3):
    if(charlist[i]=="R"):
        index += 1
    
if index==2:
    if charlist[1]=="S":
        print(1)
        
    else:
        print(index)
        
else:
    print(index)
Buggy code:
s = input()

if s == 'SSS' or s == 'RRR':
  print(3)
elif s[0] == s[-1]:
  print(1)
else:
  print(2)


Fixed code:
s = input()

if s == 'RRR':
  print(3)
elif s == 'SSS':
  print(0)
elif s[:2] == 'RR' or s[1:] == 'RR':
  print(2)
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 = input()
if s.count("R") == 1:
    print(1)
elif s.count("R") == 2:
    if s == 'RSR':
        print(1)
    else: print(2)
elif s.count("R") == 3:
    print(3)

Fixed code:
s = input()
if s.count("R") == 1:
    print(1)
elif s.count("R") == 2:
    if s == 'RSR':
        print(1)
    else: print(2)
elif s.count("R") == 3:
    print(3)
else:
    print(0)
Buggy code:
string = input()
result = string.count("R")
if(result == 2 and string[1] = "S"):
  print("1")
else:
  print(result)
  

Fixed code:
string = input()
result = string.count("R")
if(result == 2 and string[1] == "S"):
  print("1")
else:
  print(result)
Buggy code:
import re
s=input()

if s == 'RRR':
  print(3)
elif re.search(s , 'RR'):
  print(2)
elif re.search(s, 'R'):
  print(1)
else:
  print(0)

Fixed code:
import re
s=input()

if s == 'RRR':
  print(3)
elif re.search('RR',s):
  print(2)
elif re.search('R',s):
  print(1)
else:
  print(0)
Buggy code:
import sys
li  =   lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw  =   lambda : sys.stdin.readline().strip().split()
ni  =   lambda : int(sys.stdin.readline().strip())
nsi =   lambda : sys.stdin.readline().strip()

from collections import defaultdict as df
from math import *

n=nsi()
count=0
if(n[0]=='R' and n[1]=='R' and n[2]=='S'):
    print(2)
if(n[0]=='S'and n[1]=='R' and n[2]=='R'):
    print(2)
if(n[0]=='R' and n[1]=='R' and n[2]=='R'):
    print(3)

for i in n:
    if(i=='R'):
        count+=1

if(count==0):
    print(0)
if(count==1):
    print(1)


Fixed code:
import sys
li  =   lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw  =   lambda : sys.stdin.readline().strip().split()
ni  =   lambda : int(sys.stdin.readline().strip())
nsi =   lambda : sys.stdin.readline().strip()

from collections import defaultdict as df
from math import *

n=nsi()
count=0
o=0
if(n[0]=='R' and n[1]=='S'):
    print(1)
    o=1
if(n[0]=='R' and n[1]=='R' and n[2]=='S'):
    print(2)
    o=1
if(n[0]=='S'and n[1]=='R' and n[2]=='R'):
    print(2)
    o=1
if(n[0]=='R' and n[1]=='R' and n[2]=='R'):
    print(3)
    o=1

for i in n:
    if(i=='R'):
        count+=1

if(count==0):
    print(0)
if(count==1 and o==0):
    print(1)
Buggy code:
a = input()
c = 0
ans = 0
for s in a:
    if s == 'S':
        c += 1
    else:
        c = 0
    ans = max(ans,c)

print(ans)

Fixed code:
a = input()
c = 0
ans = 0
for s in a:
    if s == 'R':
        c += 1
    else:
        c = 0
    ans = max(ans,c)

print(ans)
Buggy code:
S = input()
rain_d = 0
for s in S:
    if s == 'R':
        rain_d += 1
    elif s == 'S':
        rain_d = 0
print(rain_d)


Fixed code:
S = input()
rain_d = 0
max_rain_d = 0
for s in S:
    if s == 'R':
        rain_d += 1
        max_rain_d = rain_d
    elif s == 'S':
        rain_d = 0
print(max_rain_d)
Buggy code:
str1 = input()
if str1 == 'RRR':
    print(3)
else:
    for i in range(len(str1) - 1):
        if str1[i] == str1[i+1] == 'R':
            flag = 0
            break
        else:
            flag = 1
    if flag == 0:
        print(2)
    else:
        print(1)

Fixed code:
str1 = input()
if str1 == 'RRR':
    print(3)
elif str1 == 'SSS':
    print(0)
else:
    for i in range(len(str1) - 1):
        if str1[i] == str1[i+1] == 'R':
            flag = 0
            break
        else:
            flag = 1
    if flag == 0:
        print(2)
    else:
        print(1)
Buggy code:
s = input()
ans = 0
tmp = 0
for i in range(3):
    print(s[i])
    if s[i] == "R":
        tmp += 1
    else:
        ans = tmp
        tmp = 0
if ans < tmp:
    ans = tmp
print(ans )


Fixed code:
s = input()
ans, tmp = 0, 0
for i in range(3):
    if s[i] == "R":
        tmp += 1
    else:
        ans = max(tmp, ans)
        tmp = 0
if ans < tmp:
    ans = tmp
print(ans)
Buggy code:
s=input()
ren=0
max=0
for i in range(3):
  if s[i]=="R":
    ren+=1
  if max<ren:
    max=ren
print(max)
    

Fixed code:
s=input()
ren=0
max=0
for i in range(3):
  if s[i]=="R":
    ren+=1
  else:
    ren=0
  if max<ren:
    max=ren
print(max)
Buggy code:
str=input()
maxcnt=0
cnt=0
for i in range(len(str)):
  if(str[i]=="R"):
    cnt+=1
    maxcnt=max(cnt,max)
  else:
    cnt=0
    
print(max)

Fixed code:
str=input()
maxcnt=0
cnt=0
for i in range(len(str)):
  if(str[i]=="R"):
    cnt+=1
    maxcnt=max(cnt,maxcnt)
  else:
    cnt=0
    
print(maxcnt)
Buggy code:
S = input()
if S == 'SSS':
    print(0)
elif S.count('R')==1:
    print(1)
elif S.count('R')==2:
    print(2)
else:
    print(3)

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

Fixed code:
s=input()
if s=='RRR':
  print(3)
elif s=='RRS' or s=='SRR':
  print(2)
elif s.count('R')==1 or s=='RSR':
  print(1)
else:
  print(0)
Buggy code:
def A():
    s = input()
    if s == 'SSS': print(3)
    elif s=='RSS' or s=='SSR': print(2)
    elif s=='RRR': print(0)
    else: print(1)

def B():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]): cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
A()


Fixed code:
def A():
    s = input()
    if s == 'SSS': print(0)
    elif s=='RRR': print(3)
    elif s=='RRS' or s=='SRR': print(2)
    else: print(1)

def B():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            if a[i] == a[j]: continue
            for k in range(j+1, n):
                if a[i]==a[k] or a[j] == a[k]: continue
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]):
                    cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
A()
Buggy code:
import re
r = 0
s = input()
if 'r' not in s:
  print(0)
else:
  x = re.findall('r+',s)
  if len(x) == 2:
      print(1)
  else:
      print(len(x[0]))

Fixed code:
import re
r = 0
s = input()
if 'R' not in s:
  print(0)
else:
  x = re.findall('R+',s)
  if len(x) == 2:
      print(1)
  else:
      print(len(x[0]))
Buggy code:
n = input()
if n[:2] == "RR" or n[2:] == "RR":
    print("2")
elif n == "RRR":
    print("3")
else:
    print("0")

Fixed code:
n = input()
if n == "RRR":
    print("3")
elif n[:2] == "RR" or n[1:] == "RR":
    print("2")
elif n=="SSS":
    print("0")
else:
    print("1")
Buggy code:
s = input()
ans=0

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

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:
X=str(input())
if X=='RRR':
    print(3)
elif X=='RRS' or X=='SRR':
    print(2)
elif X=='SSS':
    print(0)

Fixed code:
X=str(input())
if X=='RRR':
    print(3)
elif X=='RRS' or X=='SRR':
    print(2)
elif X=='SSS':
    print(0)
else:
    print(1)
Buggy code:
s = input()
sol = 0
if s == 'RRR':
    sol = 3
elif s == 'RRS' or s == 'SRR':
    sol == 2
elif s == 'SSS':
    sol = 0
else:
    sol = 1
print(sol)

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