qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s=input()
count=0
i=0
while i<len(s):
    summ=0
    while s[i]=='R':
        summ+=1
        i+=1
    if summ>count:
        count=summ
    i+=1


print(count)        

Fixed code:
s=input()
count=0
i=0
while i<len(s):
    summ=0
    while i<len(s) and s[i]=='R':
        summ+=1
        i+=1
    if summ>count:
        count=summ
    i+=1


print(count)
Buggy code:
s = input()
def s_count(s):
  m = list(s)
  array = [0. for i in range(len(m))]
  count = 0
  for i in range(len(m)):
    if m[i] == 'R':
      array[i] += 1
      if (i > 0 and m[i] == m[i-1]) or i == 0:
        count += 1
        array[i] += count
      else:
        count = 0
  return max(array)
s_count(s)

Fixed code:
s = input()
def s_count(s):
    m = list(s)
    array = [0. for i in range(len(m))]
    count = 0
    for i in range(len(m)):
        if m[i] == 'R':
            array[i] += 1
            if (i > 0 and m[i] == m[i-1]):
                count += 1
                array[i] += count
            else:
                count = 0
    return max(array)
print(int(s_count(s)))
Buggy code:
s=input().upper()
c=0
largest=0


for i in range(len(s)-1):
    if s[i] == "R" and s[i] == s[i+1]:
        if c==0:
            c+=1
        c+=1
        #print("dasd",c,i,len(s))
    else:
        #print("asd", c)
        if c > largest:
            largest=c
        c=0
    if i + 2 == len(s):
        #print("asdfasd")
        if c > largest:
            largest=c

print(largest)


Fixed code:
s=input().upper()
c=0
largest=0


for i in range(len(s)-1):
    if s[i] == "R":
        if c == 0:
            c+=1
        if s[i] == s[i+1]:
            c+=1
        #print("dasd",c,i,len(s))
    else:
        #print("asd", c)
        if c > largest:
            largest=c
        c=0
    if i + 2 == len(s):
        if s[i+1] == "R" and c == 0:
            c+=1
        #print("asdfasd")
        if c > largest:
            largest=c

print(largest)
Buggy code:
a=input()
max=[0]*4
for i in range(3):
  if a[i]== 'R':
    if i ==0:
      max[0]=1
    else:
      max[i]=max[i-1]+1
  else:
    max[i]=0
print(max)
  

Fixed code:
a=input()
f=[0]*3
for i in range(3):
  if a[i]== 'R':
    if i ==0:
      f[0]=1
    else:
      f[i]=f[i-1]+1
  else:
    f[i]=0
print(max(f))
Buggy code:
s = input()

if s.count('R') == 2:
  print(s.count('RR'+1)
else:
  print(s.count('R')

Fixed code:
s = input()

if s.count('R') == 2:
    print(s.count('RR')+1)
else:
    print(s.count('R'))
Buggy code:
s = list(input())

if(s[0] == s[1] == s[2] == "R"):
    ans = 3
elif(s[0] == s[1] == "R" or s[2] == s[1] == "R"):
    ans = 2
elif(s[0] == s[1] == s[2] == "S"):
    ans = 0
else:
    ans = 1

pritn(ans)


Fixed code:
s = list(input())

if(s[0] == s[1] == s[2] == "R"):
    ans = 3
elif(s[0] == s[1] == "R" or s[2] == s[1] == "R"):
    ans = 2
elif(s[0] == s[1] == s[2] == "S"):
    ans = 0
else:
    ans = 1

print(ans)
Buggy code:
S = list(input())

if S == "RSR":
    ans = 1
else:
    ans = S.count("R")

print(ans)


Fixed code:
S = input()

if S == "RSR":
    ans = 1
else:
    S = list(S)
    ans = S.count("R")

print(ans)
Buggy code:
s = rawinput()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)

Fixed code:
s = input()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)
Buggy code:
s = list(input())
if (s[0]=="S" and s[1]=="S" and s[2]=="S"):
  print(3)
elif (s[0]=="S" and s[1]=="S") or (s[1]=="S" and s[2]=="S"):
         print(2)
elif s[0]!="S" and s[1]!="S" and s[2]!="S":
         print(0)
else:
         print(1)



Fixed code:
s = list(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]!="R" and s[1]!="R" and s[2]!="R":
         print(0)
else:
         print(1)
Buggy code:

import re
S = input()
mmm = re.findall("RRR", S)
mm = re.findall("RR", S)
m = re.findall("R", S)
if mmm:
    print(3)
elif mm:
    print(2)
else:
    print(1)


Fixed code:

import re
S = input()
mmm = re.findall("RRR", S)
mm = re.findall("RR", S)
m = re.findall("R", S)
if mmm:
    print(3)
elif mm:
    print(2)
elif m:
    print(1)
else:
    print(0)
Buggy code:
s=input()
if s.count("S")==0:
    print(0)
elif s.count("S")==1:
    print(1)
elif s.count("S")==3:
    print(3)
else:
    if s[1]=="S":
        print(2)
    else:
        print(1)

Fixed code:
s=input()
if s.count("R")==0:
    print(0)
elif s.count("R")==1:
    print(1)
elif s.count("R")==3:
    print(3)
else:
    if s[1]=="R":
        print(2)
    else:
        print(1)
Buggy code:
s = str(input())
s = list(s)

cnt = 0

for i in range(3):
    if(s[i] == "S"):
        cnt += 1

if(s[0] == "S" and s[1] == "R" and s[2] == "S"):
    cnt = 1


print(cnt)

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

cnt = 0

for i in range(3):
    if(s[i] == "R"):
        cnt += 1

if(s[0] == "R" and s[1] == "S" and s[2] == "R"):
    cnt = 1


print(cnt)
Buggy code:
s=input()
if s=="RRR":
    print(3)
elif s="RR":
    print(2)
elif s="R":
    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=str(input())
if S=="SSS":
    print(0)
elif S=="RRR":
    print(3)
elif S=="RRS" or "SRR":
    print(2)

else:
    print(1)

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

Fixed code:
S = input()
s = [i for i in S]
if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if S == 'RSR':
        print(1)
    else:
        print(2)
Buggy code:
a=input()

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

Fixed code:
a=input()

if a == "RRR":
  answer=3
elif a=="RRS" or a=="SRR":
  answer=2
elif a=="SSS":
  answer=0
else:
  answer=1
  
print(answer)
Buggy code:
N = input()
for i in range(1,4):
  p = "R"*i
  if p in N:
    ans = i
print(ans)

Fixed code:
N = input()
ans = 0
for i in range(1,4):
  p = "R"*i
  if p in N:
    ans = i
print(ans)
Buggy code:
N = input()
if N == "RRR":
  print(3)
elif N == "SSS":
  print(0)
elif N == "SRR" or "RRS":
  print(2)
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:
a = list(input())
c = 0
x = []
for i in a:
    print(i)
    if i == 'R':
        c += 1
    else:
        x.append(c)
        c = 0
    x.append(c)
print(max(x))

Fixed code:
a = list(input())
c = 0
x = []
for i in a:
    
    if i == 'R':
        c += 1
    else:
        x.append(c)
        c = 0
    x.append(c)
print(max(x))
Buggy code:
z=[]
a=input()
for i in a:
    z.append(i)
if z[0]=='R':
    if z[1]=='R':
        print(2)
elif z[1]=='R':
    if z[2]=='R':
        print(2)
elif z[0]=='S':
    if z[1]=='S':
        if z[2]=='S':
            print(0)
else: 
    print(1)

Fixed code:
z=[]
a=input()
for i in a:
    z.append(i)

if (z[0]=='R') and (z[1]=='R') and (z[2]=='S'):
        print(2)
elif (z[1]=='R') and (z[2]=='R') and (z[0]=='S'):
        print(2)
elif (z[0]=='S') and (z[1]=='S') and (z[2]=='S'):
        print(0)
elif (z[0]=='R') and (z[1]=='R') and (z[2]=='R'):
        print(3)
else: 
    print(1)
Buggy code:
import sys

def read_input():
  return sys.stdin.readline().strip().split(' ')

def task(s):
  rainy_til = []
  l = len(s)
  i = 0
  while i < l:
    if s[i] == 'R':
      last_rainy = rainy_til[i-1] if i > 0 else 0
      rainy_til[i] = last_rainy + 1
    else:
      rainy_til[i] = 0
  return max(rainy_til)

def main():
  s = read_input()
  result = task(s)
  print(result)


Fixed code:
import sys


def read_input():
    return sys.stdin.readline().strip().split(' ')


def task(s):
    rainy_til = []
    l = len(s)
    i = 0
    while i < l:
        if s[i] == 'R':
            last_rainy = rainy_til[i - 1] if i > 0 else 0
            rainy_til.append(last_rainy + 1)
        else:
            rainy_til.append(0)
        i += 1
    return max(rainy_til)


def main():
    [s] = read_input()
    result = task(s)
    print(result)


main()
Buggy code:
S = input()

if S.count("RRR") <= 1:
  print("3")
elif S.count("RR") <= 1:
  print("2")
elif S.count("R") <= 1:
  print("1")
else:
  print("0")

Fixed code:
S = input()

if S.count("RRR") >= 1:
  print("3")
elif S.count("RR") >= 1:
  print("2")
elif S.count("R") >= 1:
  print("1")
else:
  print("0")
Buggy code:
S = input()
answers = [0]
ans = 0
i = 0
while i <= 2:
  if S[i] == 'R':
    ans += 1
  else:
    answers.append(ans)
    ans += 0
  i += 1

answers.append(ans)

print(max(answers))


Fixed code:
S = input()
answers = [0]
ans = 0
i = 0
while i <= 2:
  if S[i] == 'R':
    ans += 1
  else:
    answers.append(ans)
    ans = 0
  i += 1

answers.append(ans)

print(max(answers))
Buggy code:
S = input()
for si in S:
    renzoku = 0
    if si == 'R':
        renzoku += 1
    else:
        renzoku = 0
print(renzoku)

Fixed code:
S = input()
if S == 'RSR':
    renzoku = 1
else:
    renzoku = 0
    for si in S:
        if si == 'R':
            renzoku += 1

print(renzoku)
Buggy code:
S=list(input())
ans=0
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

print(ans)



Fixed code:
S=list(input())
ans=0

for i in range(len(S)):
    if ans==0 and S[i]=="R":
        ans=1
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

print(ans)
Buggy code:
days = input()

day1 = days[0]
day2 = days[1]
day3 = days[2]


ans = 0

if day1 == "R":
    ans += 1
    if day2 == "R":
        ans += 1
        if day3 == "R":
            ans +=1
 
if day2 == "R":
    ans += 1
    if day3 == "R":
         ans +=1

if day3 == "R":
    ans +=1

print(ans)

Fixed code:
days = input()

day1 = days[0]
day2 = days[1]
day3 = days[2]

ans = 0

if day1 == "R":
    ans += 1
    if day2 == "R":
        ans += 1
        if day3 == "R":
            ans +=1
elif day2 == "R":
    ans += 1
    if day3 == "R":
         ans +=1

elif day3 == "R":
    ans +=1

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

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

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

Fixed code:
s = list(input())
box = []
cnt = 0
for i in s:
	if i == 'R':
		cnt += 1
	else:
		box.append(cnt)
		cnt = 0
box.append(cnt)
print(max(box))
Buggy code:
S = input()
if S == "RRR":
    print(3)
elif S in "RR":
    print(2)
elif S in "R":
    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:
S = list(input())

cnt = 0

if S[0]=="R":
    cnt = 1

if S[1]=="R":
    cnt += 1
    if S[2]=="R":
        cnt += 1
else:
    if S[2]=="R":
        cnt += 1
    
    
print (cnt)

Fixed code:
S = list(input())

cnt = 0

if S[0]=="R":
    cnt = 1

if S[1]=="R":
    cnt += 1
    if S[2]=="R":
        cnt += 1
else:
    if S[2]=="R":
        cnt = 1
    
    
print (cnt)
Buggy code:
s=input()
s1=list(s)


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

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

if s[0]=='R' and s[1]=='S' and s[2]=='R':
    print('1')
elif s[0]=='R' and s[1]=='R' and s[2]=='R':
    print('3')
elif s[0]=='R' and s[1]=='R' and s[2]=='S':
    print('2')
elif s[0]=='S' and 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:
s=list(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[2]=='R' and s[1]=='R') or (s[0]=='R' and s[2]=='R')):
  print(2)
elif (s[0]=='S' and s[1]=='S' and s[2]=='S'):
  print(0)
else:
  print(1)

Fixed code:
s=list(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[2]=='R' and s[1]=='R')):
  print(2)
elif (s[0]=='S' and s[1]=='S' and s[2]=='S'):
  print(0)
else:
  print(1)
Buggy code:
import sys
input = sys.stdin.readline
def main():
    S = input().rstrip()
    CNT = 0
    ans = 0
    for c in S:
        if c == 'R':
            CNT += 1
        else:
            ans = max(ans,CNT)
            CNT = 0
    print(ans)


if __name__ == '__main__':
    main)

Fixed code:
import sys
input = sys.stdin.readline
def main():
    S = input().rstrip()
    CNT = 0
    ans = 0
    for c in S:
        if c == 'R':
            CNT += 1
        else:
            ans = max(ans,CNT)
            CNT = 0

    ans = max(ans,CNT)
    print(ans)


if __name__ == '__main__':
    main()
Buggy code:
s=input()
if s[0]=="R" and s[1]=="R" and s[2]=="R":
    print(3)
elif s[0]=="R" and s[1]=="R":
    print(2)
elif s[1]=="R" and s[2]=="R":
    print(2)
elif s[0]=="R" and s[2]=="R":
    print(2)
elif s=="SSS":
    print(0)
else:
    print(1)

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

if str in 'RRR':
  print(3)
elif str in 'RR':
  print(2)
elif str in 'R':
  print(1)
else:
  print(0)

Fixed code:
str = input()

if 'RRR' in str:
  print(3)
elif 'RR' in str:
  print(2)
elif 'R' in str:
  print(1)
else:
  print(0)
Buggy code:
s = input()
S = list(s)
re = 0
a = 0
for i in range(3):
    if S[i] == 'R':
        a += 1
if a > 0:
    if a == 2:
        if S[0] == S[1] or S[1] == S[2]:
            re = 2
    elif S[0] == S[1] and S[1] == S[2] and a == 3:
        re = 3
    else:
        re = 1
else:
    re = 0
print(re)

Fixed code:
s = input()
S = list(s)
re = 0
a = 0
for i in range(3):
    if S[i] == 'R':
        a += 1
if a > 0:
    if a == 2:
        if S[0] == S[1] or S[1] == S[2]:
            re = 2
        else:
            re = 1
    elif S[0] == S[1] and S[1] == S[2] and a == 3:
        re = 3
    else:
        re = 1
else:
    re = 0
print(re)
Buggy code:
s = input().strip().split('S')
print(max(s, key = len))


Fixed code:
s = input().strip().split('S')
print(len(max(s, key = len)))
Buggy code:
import sys
from collections import Counter


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
ans = 0
if 'R' not in s:
    ans = 0
else:
    c = Counter(list(s))
    if c['R'] == 1:
        ans = 1
    else:
        if s[:2] == 'RR' or s[1:] == 'RR':
            ans = 2
        if s == 'RRR':
            ans = 3

print(ans)


Fixed code:
import sys
from collections import Counter


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()

if s == 'RRR':
    ans = 3
elif s[:2] == 'RR' or s[1:] == 'RR':
    ans = 2
else:
    c = Counter(list(s))
    if c['R'] == 1:
        ans = 1
    elif c['S'] == 3:
        ans = 0
    else:
        ans = 1

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

Fixed code:
s = input()
if s == "SSS":
  print(0)
elif s == "RRR":
  print(3)
elif s == "RRS" or s ==  "SRR":
  print(2)
else:
  print(1)
Buggy code:
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(2):
    if li[num] = "R" :
        count = count + 1

if count = 0 :
    re_num = 0
elif count = 1 :
    re_num = 1
elif count = 2 and li[2] = "S" :
    re_num = 1
elif count = 2 and li[2] = "R" :
    re_num = 2
else re_num = 3

print(re_num)

Fixed code:
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(3):
    if li[num] == "R" :
        count = count + 1

if count == 0 :
    re_num = 0
elif count == 1 :
    re_num = 1
elif count == 2 and li[1] == "S" :
    re_num = 1
elif count == 2 and li[1] == "R" :
    re_num = 2
else :
    re_num = 3

print(re_num)
Buggy code:
S = input()

if S == "SSS":
    print(3)
elif (S == "RRS" or S == "SRR"):
    print(2)
elif S == "RRR":
    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:
a = input()
s = 0
if a == "RRR":
  s = 3
elif a == "RRS" or a == "SRR":
  s = 2
elif a = "SSS":
  s = 0
else:
  s = 1
print(s)

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

if "RRR" in S:
  print(3)
else "RR" in S:
  print(2)
else "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:
L = [s for s in input()]
if not 'R' in L:
  print(0)
elif not 'S' in L:
  print(3)
elif L[2] == 'S':
  if 'R' in L :
    print(1)
else:
  print(2)

Fixed code:
L = [s for s in input()]
if not 'R' in L:
  print(0)
elif not 'S' in L:
  print(3)
elif L[1] == 'S':
  if 'R' in L :
    print(1)
elif L[0] == 'S':
  if L[2] =='S':
    print(1)
  else:
    print(2)
else:
  print(2)
Buggy code:
s = input()

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

print(ans)

Fixed code:
s = input()

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

ans = max(ans, r)
print(ans)
Buggy code:
a=input()
if a==SSS:
  print(0)
elif a=RRR:
  print(3)
elif a=RRS or a=SRR:
  print(2)
else:
  print(1)

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


Fixed code:
s = 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 = list(input())

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

Fixed code:
S = list(input())

if S.count("R") == 3:
    print(3)
if S.count("R") == 1:
    print(1)
if S.count("R") == 2:
    if S[0] == "R" and S[2] == "R":
        print(1)
    else:
        print(2)
if S.count("R") == 0:
    print(0)
Buggy code:
S = input()
cnt = 0
if S.count("S") == 3:
  cnt = 3
elif S.count("S") == 1:
  cnt = 1
elif S.count("S") == 0:
  cnt = 0
else:
  if (S[0] == "S" and S[1] == "S") or (S[1] == "S" and S[2] == "S"):
    cnt = 2
  else:
    cnt = 1
print(cnt)

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

Fixed code:
s = input()
if(s =="RRS")or(s =="SRR"):
    print(2)
elif(s =="RRR"):
    print(3)
elif(s =="SSS"):
    print(0)
else:
    print(1)
Buggy code:
x = max(map(len,input().split(S)))
print(x)

Fixed code:
x = max(map(len,input().split("S")))
print(x)
Buggy code:
s = input()
temp = 0
ans = 0
for i in s:
    if(i == "R"):
        temp += 1
    else:
        if(temp > ans):
            ans = temp
if(temp > ans):
    ans = temp
print(temp)

Fixed code:

s = input()
temp = 0
ans = 0
for i in s:
    if(i == "R"):
        temp += 1
    else:
        if(temp > ans):
            ans = temp
            temp = 0
if(temp > ans):
    ans = temp
print(ans)
Buggy code:
s = input()
if "R" in s:
  a = 1
  if "RR" in s:
    a += 1
    if "RRR" in s:
      a += 1
print(a)

Fixed code:
s = input()
a=0
if "R" in s:
  a = 1
  if "RR" in s:
    a += 1
    if "RRR" in s:
      a += 1
print(a)
Buggy code:
s=input()
count=0
for i in range(len(s)):
  if s[i]=='R':
    count+=1
    max1=count
  elif s[i]=='S':
    count=0
print(max1)

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

Fixed code:
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
r.append(c)
if not len(r):
  print(c)
else:
  print(max(r))
Buggy code:
import re
S = input()
if re.search(r'R{3}', S):
  a = 3
elif re.search(r'R{2}', S):
  a = 2
elif re.search(r'R{1}', S):
  a = 1
else:
  a = 1
print(a)

Fixed code:
import re
S = input()
if re.search(r'R{3}', S):
  a = 3
elif re.search(r'R{2}', S):
  a = 2
elif re.search(r'R{1}', S):
  a = 1
else:
  a = 0
print(a)
Buggy code:
#A
import sys
s = input()

num = s.count("R")

if num >= 2:
    if s[1] == "R":
        num = 1

print(num)

Fixed code:
#A
import sys
s = input()

num = s.count("R")

if num >= 2:
    if s[1] == "S":
        num = 1

print(num)
Buggy code:
a=0
S=input()
if('R' in S):
    a=1
for i in range(2):
    if(S[i]==S[i+1]):
        a=a+1
print(a)

Fixed code:
a=0
S=input()
if('R' in S):
    a=1
for i in range(2):
    if(S[i]==S[i+1] and S[i]=='R'):
        a=a+1
print(a)
Buggy code:
s=input()
ans=1
if s[0]=="R" and s[1]=="R":
  ans=2

if s[1]=="R" and s[2]=="R":
  ans=2

if s[0]=="R" and s[1]=="R" and s[2]=="R":
  ans=3

print(ans)

Fixed code:
s=input()
ans=0

if s[0]=="R" or s[1]=="R" or s[2]=="R":
  ans=1
if s[0]=="R" and s[1]=="R":
  ans=2

if s[1]=="R" and s[2]=="R":
  ans=2

if s[0]=="R" and s[1]=="R" and s[2]=="R":
  ans=3

print(ans)
Buggy code:
S = input()
if S = "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "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:
s = input()
maxCount = 0
count = 0

for i in s:
  if(i == 'r'):
    count += 1
  else:
    maxCount = max(count, maxCount)
    count = 0
    
print(maxCount)

Fixed code:
s = input()
maxCount = 0
count = 0

for i in s:
  if(i == 'R'):
    count += 1
  else:
    maxCount = max(count, maxCount)
    count = 0
    
print(max(count, maxCount))
Buggy code:
weather = input()

raining = False
count = 0
max = 0
for w in weather:
    if w == 'R':
        if not raining:
            raining = True
            count = 1
        else:
            count += 1
        if max < count:
            max = count
    elif w == 'S':
        raining = False
        count = 0

Fixed code:
weather = input()

raining = False
count = 0
max = 0
for w in weather:
    if w == 'R':
        if not raining:
            raining = True
            count = 1
        else:
            count += 1
    elif w == 'S':
        raining = False
        count = 0
    if max < count:
        max = count

print(max)