qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s = input()
chrlis = []
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    start = i
    for j in range(i,len(s)):
      if s[j]=="A" or s[j]=="C" or s[j]=="G" or s[j]=="T":
        end = j
      else:
        break
  else:
    continue
  chrlis.append(s[start:end+1])

ans = 0
for i in range(len(chrlis)):
  tmp = len(chrlis[i])
  if tmp>ans:
    ans = tmp
print(chrlis,ans)

Fixed code:
s = input()
chrlis = []
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    start = i
    for j in range(i,len(s)):
      if s[j]=="A" or s[j]=="C" or s[j]=="G" or s[j]=="T":
        end = j
      else:
        break
  else:
    continue
  chrlis.append(s[start:end+1])

ans = 0
for i in range(len(chrlis)):
  tmp = len(chrlis[i])
  if tmp>ans:
    ans = tmp
print(ans)
Buggy code:
s = input()
m = 0
l = 0
for c in s:
    if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
        m = max(m, l)
        l = 0
        continue

    l += 1

print(l)

Fixed code:
s = input()
m = 0
l = 0
for c in s:
    if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
        m = max(m, l)
        l = 0
        continue

    l += 1

m = max(m, l)
print(m)
Buggy code:
S = input()
# print(S)
# print(len(S))
list = []
for i in range(len(S)):
    if(S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T"):
        list.append(i)
# print(list)
NUM = []
for j in range(len(list)):
    num = 1
    for k in range(len(list) - j - 1):
        # print("k",k)
        if(list[k+1] - list[k] == 1):
            num += 1
            # print("k1:",k)
        else:
            NUM.append(num)
# print(NUM)
if(len(NUM) == 0):
    print(0)
else:
    print(max(NUM))


Fixed code:
S = input()
# print(S)
# print(len(S))
list = []
for i in range(len(S)):
    if(S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T"):
        list.append(i)
# print(list)
NUM = []
for j in range(len(list)):
    num = 1
    for k in range(j,len(list)-1):
        # print("k:",k)
        # print("list[j+1]:",list[j+1], "list[j]:", list[j])
        # print("list[k+1]:",list[k+1], "list[k]:", list[k])
        if(list[k+1] - list[k] == 1):
        # if(list[j+1] - list[j] == 1):
            num += 1
            # print("k1:",k)
        else:
            NUM.append(num)
            # print("NUM1:", NUM)
            break
    else:
        NUM.append(num)
        # print("NUM2:", NUM)

# print("NUM3:",NUM)
if(len(NUM) == 0):
    print(0)
else:
    print(max(NUM))
Buggy code:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count++
  else:
    list.append(count)
    count = 0
print(max(list))
    

Fixed code:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))
Buggy code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    ACGT = {"A", "C", "G", "T"}

    max_length = 0
    for i in range(0, len(S)):
        length = 0
        j = i
        while S[j] in ACGT and j < len(S):
            length += 1
            j += 1
        max_length = length if length > max_length else max_length
    return max_length


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    ACGT = {"A", "C", "G", "T"}

    max_length = 0
    for i in range(0, len(S)):
        length = 0
        j = i
        while j < len(S) and S[j] in ACGT:
            length += 1
            j += 1
        max_length = length if length > max_length else max_length
    return max_length


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Buggy code:
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = 0
temp = []
for i in range(length):
  if str(mojilst[i]) == "A" or str(mojilst[i]) == "G" or str(mojilst[i]) == "C" or str(mojilst[i]) == "T":
    temp.append(str(mojilst[i]))
  else:
    if len(ans) < len(temp):
      ans = len(temp)
    temp = []
print(ans)

Fixed code:
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = 0
temp = []
for i in range(length):
  if str(mojilst[i]) == "A" or str(mojilst[i]) == "G" or str(mojilst[i]) == "C" or str(mojilst[i]) == "T":
    temp.append(str(mojilst[i]))
  else:
    if ans < len(temp):
      ans = len(temp)
    temp = []
if ans < len(temp):
      ans = len(temp)
print(ans)
Buggy code:
s = list(input())
cnt,ans = [],0
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
         ans.append(cnt)
         cnt = 0
if ans == []:
    ans.append(0)
print(max(ans))

Fixed code:
s = list(input())
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt > 0:
  ans.append(cnt)
print(max(ans))
Buggy code:
l = ('A', 'T', 'C', 'G')
S = input()

ans = [0]
for i in range(len(S)):
    if S[i] in l:
        res += 1
    elif res != 0:
        ans.append(res)
        res = 0

print(max(ans))

Fixed code:
l = ('A', 'T', 'C', 'G')
S = input()

ans = [0]
res = 0
for i in range(len(S)):
    if S[i] in l:
        res += 1
    elif res != 0:
        ans.append(res)
        res = 0
ans.append(res)

print(max(ans))
Buggy code:
# B - ATCoder
S = int(input())
ans = 0
tmp = 0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
ans = max(ans,tmp)
print(ans)

Fixed code:
# B - ATCoder
S = input()
ans = 0
tmp = 0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
ans = max(ans,tmp)
print(ans)
Buggy code:
S = input()
m = 0
n = 0
lst = []
for i in range(len(S)):
  n += 1
  if i not in "ACGT":
    lst.append(n)
for y in range(len(lst)-1):
  if (lst[y+1] - lst[y]) > m:
    m = (lst[y+1] - lst[y])
print (m-1)
  

Fixed code:
S = input()
S ="w"+ S + "w"
m = 0
n = 0
lst = []
for i in S:
  n += 1
  if i not in "ACGT":
    lst.append(n)
for y in range(len(lst)-1):
  if (lst[y+1] - lst[y]) > m:
    m = (lst[y+1] - lst[y])
print (m-1)
Buggy code:
S = input()
maxv = 0
tmp = 0
t = list("ATCG")
for i in range(len(S)):
    for j in range(i, len(S)):
        if S[j] in t:
            tmp += 1
        else:
            maxv = max(maxv, tmp)
            tmp = 0
print(maxv)


Fixed code:
S = input()
maxv = 0
tmp = 0
t = list("ATCG")
for i in range(len(S)):
    if S[i] in t:
        tmp += 1
        maxv = max(maxv, tmp)
    else:
        tmp = 0
print(maxv)
Buggy code:
S = input()
max_len = 0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        s = S[i:j]
        s = s.replace('A', '.')
        s = s.replace('T', '.')
        s = s.replace('G', '.')
        s = s.replace('C', '.')
        flag = True
        for ss in s:
            if ss != '.':
                flag = False
                print(s)
        if flag:
            if max_len < len(s):
                max_len = len(s)
print(max_len)


Fixed code:
S = input()
max_len = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        s = S[i:j]
        s = s.replace('A', '.')
        s = s.replace('T', '.')
        s = s.replace('G', '.')
        s = s.replace('C', '.')
        flag = True
        for ss in s:
            if ss != '.':
                flag = False
        if flag:
            if max_len < len(s):
                max_len = len(s)
print(max_len)
Buggy code:
S = input()
X = 'ATCG'
res = []
cnt = 0
for s in S:
    if s in X:
        cnt += 1
        res.append(cnt)
    else:
        cnt = 0
print(max(res))

Fixed code:
S = input()
X = 'ATCG'
res = [0]
cnt = 0
for s in S:
    if s in X:
        cnt += 1
        res.append(cnt)
    else:
        cnt = 0
print(max(res))
Buggy code:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            print(0)
            break
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)
    print(check)

Fixed code:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if not check:
        print(0)
        break
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            check.pop(0)
            continue
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)
Buggy code:
tmp = input()

out_1 = 0
for c in tmp:
        tmp_s = []
        if c == "A" or c == "G" or c == "T" or c == "C":
                tmp_s.append(c)
        elif out_1 < len(tmp_s):
                out_1 = len(tmp_s)

print(out_1)

Fixed code:
tmp = input()

out_1 = 0
tmp_s = []
for c in tmp:
        if c == "A" or c == "G" or c == "T" or c == "C":
                tmp_s.append(c)
        else:
                if out_1 < len(tmp_s):
                        out_1 = len(tmp_s)
                tmp_s = []
if out_1 < len(tmp_s):
        out_1 = len(tmp_s)
print(out_1)
Buggy code:
S = input()
ans = 0
for i in range(0,len(S)):
  tmp = S[i]
  if(tmp == "A" or tmp == "G" or tmp == "C" or tmp == "T"):
    ans += 1
  else:
    ans = 0
print(str(ans))

Fixed code:
S = input()
ans = 0
tmp2 = 0
for i in range(0,len(S)):
  tmp = S[i]
  if(tmp == "A" or tmp == "G" or tmp == "C" or tmp == "T"):
    ans += 1
  else:
    ans = 0
  tmp2 = max(ans,tmp2)
print(str(tmp2))
Buggy code:
s = list(input())
key = ['A','T','G','C']

count = 0
ans = 0
for i in range(n):
  if s[i] in key: count += 1
  else: count = 0
  ans = max(ans,count)
print(ans)


Fixed code:
s = list(input())
key = ['A','T','G','C']

count = 0
ans = 0
for i in range(len(s)):
  if s[i] in key: count += 1
  else: count = 0
  ans = max(ans,count)
print(ans)
Buggy code:
a = input()
count = 0
mx = 0
for i in range(len(a)):
	if a[i] == "A" or a[i] == "C" or a[i] == "G" or a[i] == "T":
      count += 1
    else:
      count = 0
    if ma < count:
      mx = count
print(mx)

Fixed code:
a = input()
count = 0
mx = 0
for i in range(len(a)):
    if a[i] == "A" or a[i] == "C" or a[i] == "G" or a[i] == "T":
        count += 1
    else:
        count = 0
    if mx < count:
        mx = count
print(mx)
Buggy code:
s = input()
tgt = ['A', 'C', 'G', 'T']

lst = []
cnt = 0

for x in s:
  if x in tgt:
    cnt = cnt +1
  else:
    lst.append(cnt)
    cnt = 0

print(max(lst)


Fixed code:
s = input()
tgt = ['A', 'C', 'G', 'T']

lst = []
cnt = 0

for x in s:
  if x in tgt:
    cnt = cnt +1
  else:
    lst.append(cnt)
    cnt = 0
    
lst.append(cnt)

print(max(lst))
Buggy code:
import re
S = input()
ans = []
for i in range(len(S)):
    for k in range(i, len(S)):
        ans.append(S[i:k+1])
ans = sorted(ans,key=lambda x:len(x),reverse=True)
for i in ans:
    if len(re.sub("[ACGTacgt]", "", i)) == 0:
        print(len(i))
        break

Fixed code:
import re
S = input()
ans = ['']
for i in range(len(S)):
    for k in range(i, len(S)):
        ans.append(S[i:k+1])
ans = sorted(ans,key=lambda x:len(x),reverse=True)
for i in ans:
    if len(re.sub("[ACGTacgt]", "", i)) == 0:
        print(len(i))
        break
Buggy code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        print(s_list[i], s_list[j])
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
            break
ans = max(ans, tmp_ans)
print(ans)

Fixed code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
        if j == n - 1:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
ans = max(ans, tmp_ans)
print(ans)
Buggy code:
s = input()
max_re = 0
for i in range(len(s)):
    tar_s = s[i:]
    tar_s = re.search(r'(A|T|C|G)*', tar_s).group()
    max_re = max(max_re, len(tar_s))
print(max_re)

Fixed code:
import re
s = input()
max_re = 0
for i in range(len(s)):
    tar_s = s[i:]
    tar_s = re.search(r'(A|T|C|G)*', tar_s).group()
    max_re = max(max_re, len(tar_s))
print(max_re)
Buggy code:
s =input()
ans = re.finditer(r'(A|T|G|C)+',s)
max=0
for a in ans:
    temp=len(a.group())
    if temp>=max:
        max=temp
print(max)

Fixed code:
import re
s =input()
ans = re.finditer(r'(A|T|G|C)+',s)
max=0
for a in ans:
    temp=len(a.group())
    if temp>=max:
        max=temp
print(max)
Buggy code:
s = input()
t = ['A','C','G','T']

ans = 0
tmp_ans = 0
for i in s:
    if i in t:
        tmp_ans += 1
        print(i)
    else:
        ans = max(tmp_ans, ans)
        tmp_ans = 0
ans = max(tmp_ans, ans)
print(ans)

Fixed code:
s = input()
t = ['A','C','G','T']

ans = 0
tmp_ans = 0
for i in s:
    if i in t:
        tmp_ans += 1
    else:
        ans = max(tmp_ans, ans)
        tmp_ans = 0
ans = max(tmp_ans, ans)
print(ans)
Buggy code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        count += 1
        continue
    else:
        max(count_max,count)
        count = 0

print(count_max)

Fixed code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        count += 1
    else:
        count_max = max(count_max,count)
        count = 0
count_max = max(count_max,count)
print(count_max)
Buggy code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        while True:
            if S[i+j] in list_atgc:
                demand_list.append(S[i:j+1])
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Fixed code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        string_k = ""
        while True:
            if S[i+j] in list_atgc:
                string_k += S[i+j]
                demand_list.append(string_k)
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)
Buggy code:
print(max([sum(1 for _ in s[1]) if [0] == 'A' else 0 for s in __import__('itertools').groupby(input().replace('T', 'A').replace('G', 'A').replace('C', 'A'))]))

Fixed code:
print(max([sum(1 for _ in s[1]) if s[0] == 'A' else 0 for s in __import__('itertools').groupby(input().replace('T', 'A').replace('G', 'A').replace('C', 'A'))]))
Buggy code:
s=input()
l=list(s)
m=0
for i in range(len(l)):
    if l[i]!="A" and l[i]!="T" and l[i]!="C" and l[i]!="G":
        l[i]="."

print(l)
ss="".join(l)
ll=ss.split(".")
lll=[0]
for i in ll:
    lll.append(len(i))
print(max(lll))


Fixed code:
s=input()
l=list(s)
m=0
for i in range(len(l)):
    if l[i]!="A" and l[i]!="T" and l[i]!="C" and l[i]!="G":
        l[i]="."

ss="".join(l)
ll=ss.split(".")
lll=[0]
for i in ll:
    lll.append(len(i))
print(max(lll))
Buggy code:
S=input()
cnt=0
lis=[]
for i in range(len(S)):
    if S[i]=='A'or S[i]=='C' or S[i]=='G' or S[i]=='T':
        cnt+=1
        lis.append(cnt)
    else:
        cnt=0
print(max(lis))

Fixed code:
S=input()
cnt=0
lis=[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
        lis.append(cnt)
    else:
        cnt=0
print(max(lis))
Buggy code:
S=input()
tmp_l=0
ans=0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp_l+=1
        if tmp_l>ans:
            ans=tmp_l
print(ans)

Fixed code:
S=input()
tmp_l=0
ans=0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp_l+=1
        if tmp_l>ans:
            ans=tmp_l
    else:
        tmp_l=0
print(ans)
Buggy code:
S = input()
L = ["A", "C", "G", "T"]

arr = []
st = ""

for s in S:
    if st and s not in L:
        arr.append(st)
        st = ""
    if s in L:
        st += s

print(max(map(len, arr)))


Fixed code:
S = input()
L = ["A", "C", "G", "T"]

arr = []
st = ""

for s in S:
    if st and s not in L:
        st = ""
    if s in L:
        st += s
        arr.append(st)

print(max(map(len, arr)) if arr else 0)
Buggy code:
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
print(max(num_list))

Fixed code:
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
num_list.append(len(line))
if len(num_list)==0:print(0)
else:
    print(max(num_list))
Buggy code:
s = input()
l = 0
lenmax = 0

for i in s:
  if i in "ACGT":
    l += 1
  else:
    lenmax = max(lenmax,l)
    l = 0
print(l)

Fixed code:
s = input()
l = 0
lenmax = 0
 
for i in s:
  if i in "ACGT":
    l += 1
  else:
    lenmax = max(lenmax,l)
    l = 0
lenmax = max(lenmax,l)
print(lenmax)
Buggy code:
s = input().strip()
ans = 0
l = 0
for _s in s:
  if s in ['A', 'C', 'G', 'T']:
    l += 1
  else:
    ans = max(ans, l)
print(max(ans, l))


Fixed code:
s = input().strip()
ans = 0
l = 0
for _s in s:
  if _s in ['A', 'C', 'G', 'T']:
    l += 1
  else:
    ans = max(ans, l)
    l = 0
print(max(ans, l))
Buggy code:
s =  list(input())
combo = False
cnt = 0
ans = [] 
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        cnt = cnt + 1 
        if combo != True:
            combo = True
    elif combo:
        ans.append(cnt)
        cnt = 0
        combo = False
print(max(ans))


Fixed code:
s =  list(input())
combo = False
cnt = 0
ans = [0,] 
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        cnt = cnt + 1 
        if combo != True:
            combo = True
    else:
        if combo:
            ans.append(cnt)
            cnt = 0
            combo = False
ans.append(cnt)
print(max(ans))
Buggy code:
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0

for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    max_length=count_length
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
      
print(max_length)

Fixed code:
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0
for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
    max_length=max(max_length,1)
      
print(max_length)
Buggy code:
a = input()

b = 'ACGT'
ans =0
for i in a:
    print(i)
    now = 0
    for j in a:
        if j in b:
            now += 1
            print(now)
            ans = max(ans,now)
        else:
            now=0
print(ans)

Fixed code:
a = input()

b = 'ACGT'
ans =0
for i in a:
    now = 0
    for j in a:
        if j in b:
            now += 1
            ans = max(ans,now)
        else:
            now=0
print(ans)
Buggy code:
import  re

ss = input()
ps = r"A|C|G|T"

seq = []
counter = 0
for s in ss:
    if re.match(ps, s):
        counter += 1
        seq.append(counter)
    else:
        counter = 0
    
print(max(seq))

Fixed code:
import  re

ss = input()
ps = r"A|C|G|T"

seq = []
counter = 0
for s in ss:
    if re.match(ps, s):
        counter += 1
        seq.append(counter)
    else:
        counter = 0
seq.append(counter)
print(max(seq))
Buggy code:
S = input()
acgt = {'A', 'C', 'G', 'T'}
length = len(S)
start = 0
ans = 0
while start < length:
  while S[start] not in acgt:
    start += 1
  right = start
  while right < length and S[right] in acgt:
    right += 1
  ans = max(ans, right - start )
  start = right
print(ans)

Fixed code:
S = input()
acgt = {'A', 'C', 'G', 'T'}
length = len(S)
start = 0
ans = 0
while start < length:
  while start < length and S[start] not in acgt:
    start += 1
  right = start
  while right < length and S[right] in acgt:
    right += 1
  ans = max(ans, right - start)
  start = right
print(ans)
Buggy code:
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j])
print(ans)    
print(max(ans2)-1)

Fixed code:
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n-1):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
if s[n-1] in at:
    ans.append(n)
else:
    ans.append(n-1)

m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)

#print(ans)
#print(ans2)

if len(ans)==1:
    print(n)
elif len(ans2)==0:
    print(0)
else:
    print(max(ans2))
Buggy code:
b = input()
ACGT = 0
for i in range(len(b)):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    MAX = ACGT
    ACGT = 0
print(MAX)

Fixed code:
b = input()
len = len(b)
ACGT = 0
MAX = 0
flag = 0
for i in range(len):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    if ACGT > MAX:
      MAX = ACGT
    ACGT = 0
if ACGT > MAX:
  MAX = ACGT
print(MAX)
Buggy code:
T = list(map(str,input()))
print(T)

count = 0
flag1 = 0
list_count = []
for i in T:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        flag1 = 1
        count = count +1
    elif flag1 ==1:
        list_count.append(count)
        flag = 0
        count = 0
list_count.append(count)
print(max(list_count))


Fixed code:
T = list(map(str,input()))

count = 0
flag1 = 0
list_count = []
for i in T:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        flag1 = 1
        count = count +1
    elif flag1 ==1:
        list_count.append(count)
        flag = 0
        count = 0
list_count.append(count)
print(max(list_count))
Buggy code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
  
print(sorted(ans)[-1])

Fixed code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])
Buggy code:
# -*- coding: utf-8 -*-
S = str(input())
box = ["A", "G", "C", "T"]
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox): 
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Fixed code:
# -*- coding: utf-8 -*-
S = str(input())
box = ["A", "G", "C", "T"]
s = str()
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox):
        
        ACGTbox = s 
    s = str()
print(len(ACGTbox))