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

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

print(max(l))

Fixed code:
s=list(input())

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

l.append(cnt)
print(max(l))
Buggy code:
def main():
    ans = []
    s = input()
    count = 0
    for i in s:
        if i in "ATGC":
            count += 1
        else:
            ans.append(count)
    ans.append(count)
    print(max(ans))
        
if __name__ == "__main__":
    main()

Fixed code:
def main():
    ans = []
    s = input()
    count = 0
    for i in s:
        if i in "ATGC":
            count += 1
        else:
            ans.append(count)
            count = 0
    ans.append(count)
    print(max(ans))
        
if __name__ == "__main__":
    main()
Buggy code:
S = input()

len_s = len(S)
bases = ('A', 'C,', 'G', 'T')

ans = 0
cnt = 0

for i in range(len_s):
  if S[i] in bases:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
if cnt > 0:
  ans = max(ans, cnt)
print(ans)


Fixed code:
S = input()

len_s = len(S)
bases = ('A', 'C', 'G', 'T')

ans = 0
cnt = 0

for i in range(len_s):
  if S[i] in bases:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
if cnt > 0:
  ans = max(ans, cnt)
print(ans)
Buggy code:
#coding-utf-8

def main():
    s = str(input())
    slist = list(s)
    stk = []
    c = []
    lenmax = 0
    for i in range(len(slist)):
        if slist[i] == 'A' or slist[i] =='C' or slist[i] =='G' or slist[i] =='T':
            stk.append(slist[i])
        else:
            c.append(stk)
            if len(stk) > 0:
                stk = []
                c.append(stk)
            stk = []

    print(c)

    for j in range(len(c)):
        if len(c[j]) > lenmax:
            lenmax = len(c[j])

    print(lenmax)
if __name__ == "__main__":
    main()

Fixed code:
#coding-utf-8

def main():
    s = str(input())
    slist = list(s)
#   print(slist)
    stk = []
    c = []
    lenmax = 0
    for i in range(len(slist)):
        if slist[i] == 'A' or slist[i] =='C' or slist[i] =='G' or slist[i] =='T':
            stk.append(slist[i])
            if i == len(slist) - 1:
                c.append(stk)
        else:
            c.append(stk)
            if len(stk) > 0:
                stk = []
                c.append(stk)
            stk = []

#   print(c)

    for j in range(len(c)):
        if len(c[j]) > lenmax:
            lenmax = len(c[j])

    print(lenmax)
if __name__ == "__main__":
    main()
Buggy code:
s = ns()
atcg = set(["A", "T", "C", "G"])

ans = 0
tmp = 0
for si in s:
  if si in atcg:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
    
ans = max(ans, tmp)
print(ans)

Fixed code:
s = input()
atcg = set(["A", "T", "C", "G"])

ans = 0
tmp = 0
for si in s:
  if si in atcg:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
    
ans = max(ans, tmp)
print(ans)
Buggy code:

from sys import stdin

str = stdin.readline().rstrip()


cnt = 0
rslt = 0




for a in str:
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    print(a + " :" + str(cnt))
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


print(rslt)
    
            



Fixed code:
from sys import stdin

str = stdin.readline().rstrip()


cnt = 0
rslt = 0




for a in str:
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


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

max = 0
cnt = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
        if max < cnt:
            max = cnt
        else:
            cnt = 0

print(max)

Fixed code:
s = input()

max = 0
cnt = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
        if max < cnt:
            max = cnt
    else:
      cnt = 0

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

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))

Fixed code:
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
cntList.append(cnt)
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))
Buggy code:
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
        if Answer < count:
            Answer = count
            count = 0
        else:
            count = 0
            break

print(Answer)


Fixed code:
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
            else:
                break
        if Answer < count:
            Answer = count
            count = 0
        else:
            count = 0

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

res = []

for i in range(len(s)):
    for j in range(i, len(s)):
        check = s[i:j+1]
        if len(check) == check.count("A")+check.count("T")+check.count("C")+check.count("G"):
            res.append(len(check))
print(max(res))

Fixed code:
s = input()

res = []

for i in range(len(s)):
    for j in range(i, len(s)):
        check = s[i:j+1]
        if len(check) == check.count("A")+check.count("T")+check.count("C")+check.count("G"):
            res.append(len(check))
print(0 if res == [] else max(res))
Buggy code:
string_list = list(input())
string_len = len(string_list)
renzoku_list = []

def find_letter():
  renzoku = 0
  for i in string_len:
    if string_list[i]=='A':
      renzoku += 1
    elif string_list[i]=='C':
      renzoku += 1
    elif string_list[i]=='G':
      renzoku += 1
    elif string_list[i]=='T':
      renzoku += 1
    else:
      renzoku_list.append(renzoku)
      renzoku = 0

if 'A' in string_list:
  find_letter()
elif 'C' in string_list:
  find_letter()
elif 'G' in string_list:
  find_letter()
elif 'T' in string_list:
  find_letter()
else:
  print(0)
  
max_len = max(renzoku_list)

Fixed code:
string_list = list(input())
string_len = len(string_list)
renzoku_list = []

def find_letter():
  renzoku = 0
  for i in range(string_len):
    if string_list[i]=='A':
      renzoku += 1
    elif string_list[i]=='C':
      renzoku += 1
    elif string_list[i]=='G':
      renzoku += 1
    elif string_list[i]=='T':
      renzoku += 1
    else:
      renzoku_list.append(renzoku)
      renzoku = 0
  renzoku_list.append(renzoku)

find_letter()
  
if renzoku_list:
  max_len = max(renzoku_list)
  print(max_len)
else:
  print(0)
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 20:27:19 2019

@author: screamLab
"""

s = input()
atcg = ['A','T','C','G']
ans = 0
long = 0
for i in range(len(s)):
    if s[i] in atcg:
        if s[i+1] in atcg:
            ans += 1
        else:
            ans += 1
    long = max(long,ans)
    ans = 0
long = max(long,ans)
print(long)
        

Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 20:27:19 2019

@author: screamLab
"""

s = input()
s += 'H'
atcg = ['A','T','C','G']
ans = 0
long = 0
for i in range(len(s)):
    if s[i] in atcg:
        if i == len(s):
            break
        if s[i+1] in atcg:
            ans += 1
        else:
            ans += 1
            long = max(long,ans)
            ans = 0
long = max(long,ans)
print(long)
Buggy code:
S = input()

atgc = ['A','T','G','C']

max_count = 0
count = 0
for i in range(len(S)):
    print(count)
    if S[i] in atgc:
        count+=1
    else:
        max_count = max(max_count,count)
        count = 0
max_count = max(max_count,count)
print(max_count)

Fixed code:
S = input()

atgc = ['A','T','G','C']

max_count = 0
count = 0
for i in range(len(S)):
    if S[i] in atgc:
        count+=1
    else:
        max_count = max(max_count,count)
        count = 0
max_count = max(max_count,count)
print(max_count)
Buggy code:
S = input()
#ATCG = 'ATCG'                   
count = 0
j=0
num=[]
for i in range(len(S)):
    # for j in range(4):
    #     if S[i]==ATCG[j]:
    if (S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G') and (i==(len(S)-1)):
        count =count+1
        #print(S[i])
        num.append(count)

    elif S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        #print(S[i])
       
    else:
        num.append(count)
        j=j+1



max_num=max(num)
print(max_num)

Fixed code:
S = input()
S = S +'R'
#ATCG = 'ATCG'                   
count = 0
j=0
num=[]
for i in range(len(S)):
    # for j in range(4):
    #     if S[i]==ATCG[j]:
    # if (S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G') and (i==(len(S)-1)):
    #     count =count+1
    #     print(S[i])
    #     num.append(count)

    if S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        #print(S[i])
       
    else:
        num.append(count)
        j=j+1
        count=0


#print(num)
max_num=max(num)
print(max_num)
Buggy code:
print(max([len(s) for s in "".join(["1" if s in ["A","C","G","T"] else " " for s in input()]).split()]))

Fixed code:
print(max([len(s) for s in "".join(["1" if s in ["A","C","G","T"] else "0" for s in input()]).split("0")]))
Buggy code:
S = list(input())
ans = 0
count = 0
for i in len(S):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
print(ans)

Fixed code:
S = list(input())
ans = 0
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
if ans < count:
    ans = count
else:
    pass
print(ans)
Buggy code:
S = input()
N = len(S)
tmp = ['']
x = {'A', 'C', 'G', 'T'}
for i in range(N):
    for j in range(i, N):
        if set(S[i:j+1]) <= x:
            tmp.append(S[i:j+1])
print(max(tmp, key=len))


Fixed code:
S = input()
N = len(S)
tmp = ['']
x = {'A', 'C', 'G', 'T'}
for i in range(N):
    for j in range(i, N):
        if set(S[i:j+1]) <= x:
            tmp.append(S[i:j+1])
print(max(map(len, tmp)))
Buggy code:
S = input()
tmp = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    if S[i] in acgt:
        for j in range(i+1,len(S)):
            print(S[i:j])
            if S[j] in acgt:
                continue
            else:
                tmp =max(tmp, j-i)
                break
print(tmp)

Fixed code:
S = input()
ans = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    tmp = 0
    if S[i] in acgt:
        tmp += 1
        for j in range(i+1,len(S)):
            if S[j] in acgt:
                tmp += 1
                continue
            else:
                ans = max(ans,tmp)
                break
        ans = max(ans,tmp)
print(ans)
Buggy code:
l = ['A', 'C', 'T', 'G']
s = input()
max = 0
max_temp = 0
for i in len(s):
    if s[i] in l:
        max_temp += 1
        if max < max_temp:
            max = max_temp
    else:
        max_temp = 0
print(max)

Fixed code:
l = ['A', 'C', 'T', 'G']
s = input()
max = 0
max_temp = 0
for i in s:
    if i in l:
        max_temp += 1
        if max < max_temp:
            max = max_temp
    else:
        max_temp = 0
print(max)
Buggy code:
def function(S):
    ACGT = ['A', 'C', 'G, 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            temp = 0
            l = S[i:j]
            for x in l:
                if x not in ACGT:
                    break
            temp = len(l)
    	if temp >= ret:
        	ret = temp
    return ret

Fixed code:
def function(S):
    ACGT = ['A', 'C', 'G', 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            temp = 0
            l = S[i:j]
            const = 0
            for x in l:
                if x not in ACGT:
                    const = 1
                    break
            if const == 1:
                break
            temp = len(l)
            if temp >= ret:
                ret = temp
    return ret

S = input()
print(function(S))
Buggy code:
S=list(input())
li = ['A','T','G','C']
maxl=0
ans=0
for i in range(len(S)):
    if S[i] in li:
        leng+=1
    else:
        if leng>maxl:
            maxl=leng
        leng=0
print(maxl)

Fixed code:
S=list(input())
li = ['A','T','G','C']
ans=0
leng=0
for i in range(len(S)):
    if S[i] in li:
        leng+=1
    else:
        leng=0
    if leng>ans:
        ans=leng
print(ans)
Buggy code:
def main():
    s = input()
    l = ['A', 'G', 'T', 'C']
    ans = 0
    for j in range(len(s)):
        cnt = 0
        for i in range(j, len(s)):
            if s[i] in l:
                cnt += 1
        ans = max(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()

Fixed code:
def main():
    s = input()
    l = ['A', 'G', 'T', 'C']
    ans = 0
    for j in range(len(s)):
        cnt = 0
        for i in range(j, len(s)):
            if s[i] in l:
                cnt += 1
            else:
              break
        ans = max(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()
Buggy code:
import re

S=input()
pat = r'[ATCG]+'
parts = re.findall(pat,S)
print 0 if len(parts)==0 else max([len(part) for part in parts])

Fixed code:
import re

S=input()
pat = r'[ATCG]+'
parts = re.findall(pat,S)
if len(parts)==0:
  print(0) 
else:
  print(max([len(part) for part in parts]))
Buggy code:
s=list(input())
counts=0
lists=[]
a=len(s)
for i in range (1,a+1):
    if s[i-1]=='A':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='G':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='T':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='C':
        counts=counts+1
        lists.append(counts)
    else:
        counts=0
lists.sort()
k=len(lists)
print(lists[k-1])

Fixed code:
s=list(input())
counts=0
lists=[]
a=len(s)
for i in range (1,a+1):
    if s[i-1]=='A':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='G':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='T':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='C':
        counts=counts+1
        lists.append(counts)
    else:
        counts=0
lists.sort()
k=len(lists)
if k==0:
    print(0)
else:
    print(lists[k-1])
Buggy code:
import re
S = input()

pattern = '[A|C|G|T]+'

# findall 
results = re.findall(pattern, S, re.S)

if len(results) == 0 :
    print(0)
else :
    print(max(results))

Fixed code:
import re
S = input()

pattern = '[A|C|G|T]+'

# findall 
results = re.findall(pattern, S, re.S)

if len(results) == 0 :
    print(0)
else :
    print(len(max(results,key=len)))
Buggy code:
S = input()
List = list(S)

ans = 0
arr = []
for i in range(len(List)):
  if List[i] == "A" or List[i] == "C" or List[i] == "G" or List[i] == "T":
    ans += 1
  else:
    arr.appned(ans)
    ans = 0
    
print(max(arr))

Fixed code:
S = input()
List = list(S)

ans = 0
arr = []
for i in range(len(List)):
  if List[i] == "A" or List[i] == "C" or List[i] == "G" or List[i] == "T":
    ans += 1
  else:
    arr.append(ans)
    ans = 0
    
arr.append(ans)

print(max(arr))
Buggy code:
i=1
n=0
ans=[]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
if sta==0:
  ans=[0]
  
print(max(ans))

Fixed code:
s=input()
i=1
n=0
ans=[0]
sta=0

 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0

  if i<=len(s)&n==len(s):
    ans.append(n)
  elif n!=0:
      ans.append(n)
    
  i=i+1
  
print(max(ans))
Buggy code:
S = str(input())
N = len(S)
AGCT = ["A", "G", "C", "T"]

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)  
      ans = max(ans, x)   
       
ans = max(ans, x)        
print(ans)

Fixed code:
S = str(input())
N = len(S)
AGCT = ["A", "G", "C", "T"]

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)
          x = -1 * N
    ans = max(ans, x)   
       
ans = max(ans, x)        
print(ans)
Buggy code:
S=input()
S+="b"
print(S)
ans=0
now=0
l=[i for i in "ACGT"]

for i in range(len(S)):
  if S[i] in l:
    now+=1
  else:
    ans=max(ans,now)
    now=0

print(ans)

Fixed code:
S=input()
S+="b"

ans=0
now=0
l=[i for i in "ACGT"]

for i in range(len(S)):
  if S[i] in l:
    now+=1
  else:
    ans=max(ans,now)
    now=0

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


Fixed code:
s = input()
ACGT = 'ACGT'
ans = 0
cnt = 0
for i in s:
  if i in ACGT:
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0
print(max(ans,cnt))
Buggy code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=1
    for j in range(i,len(s)-1):
      if s[j] in "ATCG":
        if c!=1:
          c+=1
      else:
        break
  if max < c:
    max=c      
print(max) 

Fixed code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=1
    for j in range(i,len(s)):
      if s[j] in "ATCG":
        if j!=i:
          c+=1
      else:
        break
  if max < c:
    max=c      
print(max)
Buggy code:
#ABC122B
S = input()
SC= S.replace('C','A')
SCG = SC.replace('G','A')
SCGT = SCG.replace('T','A')
ans = 0
wk = 0
print(SCGT)
for i in range(int(len(S))):
    if SCGT[i:i+1] == 'A':
        wk += 1
    else:
        if wk >= ans:
            ans = wk
        wk =0
        
print(ans)

Fixed code:
#ABC122B
S = input()
SC= S.replace('C','A')
SCG = SC.replace('G','A')
SCGT = SCG.replace('T','A')
ans = 0
wk = 0
for i in range(int(len(S))):
    if SCGT[i:i+1] == 'A':
        wk += 1
    else:
        if wk >= ans:
            ans = wk
        wk =0

if wk >= ans:
    ans = wk
print(ans)
Buggy code:
s = input()

l = [0]
cnt = 0
for i in s:
    if i in 'ATCG':
        cnt += 1
    else:
        if cnt > 0:
            l.append(cnt)
        cnt += 0
l.append(cnt)

print(max(l))


Fixed code:
s = input()

l = [0]
cnt = 0
for i in s:
    if i in 'ATCG':
        cnt += 1
    else:
        if cnt > 0:
            l.append(cnt)
        cnt = 0
l.append(cnt)

print(max(l))
Buggy code:
m = 0
c = 0
for s in input().strip():
    if s in "AGCY":
        c += 1
        if c > m:
            m = c
    else:
        c = 0
print(m)


Fixed code:
m = 0
c = 0
for s in input().strip():
    if s in "AGCT":
        c += 1
        if c > m:
            m = c
    else:
        c = 0
print(m)
Buggy code:
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n-1):
  for j in range(i+1, n):
    flg = True
    for k in range(i, j):
      flg *= (S[i] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)

Fixed code:
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n):
  for j in range(i+1, n+1):
    flg = True
    for k in range(i, j):
      flg *= (S[k] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)
Buggy code:
n= input()
ans,temp = 0,0
for x in S:
    if x in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)
print(ans)

Fixed code:
n= input()
ans,temp = 0,0
for x in n:
    if x in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)
print(ans)
Buggy code:
S = str(input())
ans = []
for i in range(len(S)):
    for k in range(i+1,len(S)):
        if all("ACGT".count(c)==1 for c in S[i:k]):
            ans.append(len(S[i:k]))
print(max(ans))

Fixed code:
S = str(input())
ans = [0]
for i in range(len(S)):
    for k in range(i,len(S)):
        if all("ACGT".count(c)==1 for c in S[i:k+1]):
            ans.append(len(S[i:k+1]))
print(max(ans))
Buggy code:
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
    print(T[i])
  else:
    stock.append(count)
    count = 0

print(stock[-1])


Fixed code:
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
  else:
    stock.append(count)
    count = 0

stock.sort()
print(stock[-1])
Buggy code:
S = input()
s = {"A", "C", "G", "T"}
ans = 0
for i in S:
  if i in s:
    tmp += 1
    ans = max(ans, tmp)
  else:
    tmp = 0
print(ans)

Fixed code:
S = input()
s = {"A", "C", "G", "T"}
ans = 0
tmp = 0
for i in S:
  if i in s:
    tmp += 1
    ans = max(ans, tmp)
  else:
    tmp = 0
print(ans)
Buggy code:
S=str(input())
S2=[]
ans=0
for i in range(len(S)):
  for j in range(len(S)+1):
    S2=S[i:j]
    print(S2)
    que=len(S2)
    S2=S2.replace("A","")
    S2=S2.replace("G","")
    S2=S2.replace("C","")
    S2=S2.replace("T","")
    if S2=="":
      if que>ans:
        ans=que
    S2=[] 
print(ans)

Fixed code:
S=str(input())
S2=[]
ans=0
for i in range(len(S)):
  for j in range(len(S)+1):
    S2=S[i:j]
    que=len(S2)
    S2=S2.replace("A","")
    S2=S2.replace("G","")
    S2=S2.replace("C","")
    S2=S2.replace("T","")
    if S2=="":
      if que>ans:
        ans=que
    S2=[] 
print(ans)
Buggy code:
s=input()
n=len(s)
ans=0
for i in range(n):
  for i in range(i,n)
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)

Fixed code:
s=input()
n=len(s)
ans=0
for i in range(n):
    for j in range(i,n):
        bubun=s[i:j+1]
        flag=True
        for c in bubun:
            if(c not in ['A','G','C','T']):flag = False
        if(flag):ans = max(ans,len(bubun))
print(ans)
Buggy code:
s=input()
def c(b):
  return b=='A' or b=='G' or b=='T' or b=='C'

suc=[]
ct=0
for let in s:
  if c(let):
    ct+=1
  else:
    suc.append(ct)
    suc=0
suc.append(ct)
print(max(suc))

Fixed code:
s=input()
def c(b):
  return b=='A' or b=='G' or b=='T' or b=='C'

suc=[]
ct=0
for let in s:
  if c(let):
    ct+=1
  else:
    suc.append(ct)
    ct=0
suc.append(ct)
print(max(suc))
Buggy code:
pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)


Fixed code:
pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while right < len(s) and s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)
Buggy code:
s = input()
z = ''
ans = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        ans = 1
        for j in range(i+1, len(s)):
            if s[j] in 'ACGT':
                ans = max(ans, j-i+1)
            else:
                break
    else:
        continue
print(ans)

Fixed code:
s = input()
z = ''
ans = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        ans = max(ans, 1)
        for j in range(i+1, len(s)):
            if s[j] in 'ACGT':
                ans = max(ans, j-i+1)
            else:
                break
    else:
        continue
print(ans)
Buggy code:
result = 0
cnt = 0
b = list(input())
for str in b:
    if b == "A" or b == "T" or b == "C" or b == "G":
        cnt += 1
    else:
        result = max(result,cnt)
        cnt = 0


Fixed code:
result = 0
cnt = 0
b = list(input())
for str in b:
    if str == "A" or str == "T" or str == "C" or str == "G":
        cnt += 1
        result = max(result,cnt)
    else:
        cnt = 0
print(result)