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

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        while S[i+k] in AGCT:
            print('k=', k)
            print('i+k=',i+k)
            agct_tmp += S[i+k]
            if i+k+1 < len(S):
                k +=1
            else:
                break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
    

Fixed code:
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    #print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                #print('k=', k)
                #print('i+k=',i+k)
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
Buggy code:
S=input()
m=0
count=0
for s in S:
    if(s=="A" OR s=="C" OR s=="G" or s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)

Fixed code:
S=input()
m=0
count=0
for s in S:
    if(s=="A" or s=="C" or s=="G" or s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)
Buggy code:
s = str(input())

result = [0]
i = 0
while i < len(s):
    counter = 0
    while i + counter < len(s):
        if s[i+counter] == 'A' or s[i+counter] == 'T' or s[i+counter] == 'G' or s[i+counter] == 'C':
            counter += 1
        else:
            result.append(counter)
            i += counter +1
print(result)

Fixed code:
s = str(input())
s +='0'
result = [0]
i = 0
counter = 0
while i+counter < len(s):
    counter = 0
    h = 1
    while i + counter < len(s) and h == 1:
        if s[i+counter] == 'A' or s[i+counter] == 'T' or s[i+counter] == 'G' or s[i+counter] == 'C':
            counter += 1
        else:
            result.append(counter)
            i += counter +1
            h = 0
print(max(result))
Buggy code:
s = input()
num = []
lists = ["A","c","G","T"]
count = 0

for i in range(len(s)):
    if s[i] in lists:
        count +=1
    else:
        num.append(count)
print(max(num))
 

Fixed code:
s = input()
num = []
lists = ["A","C","G","T"]
count = 0

for i in range(len(s)):
    if s[i] in lists:
        count +=1
    else:
        num.append(count)
        count = 0
else:
    num.append(count)
print(max(num))
Buggy code:
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        print(S[i:j+1])
        flag = True
        for k in S[i:j+1]:
            if not (k=='A' or k=='C' or k=='G' or k=='T'):
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:j+1]))
print(ans)

Fixed code:
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        flag = True
        for k in S[i:j+1]:
            if not (k=='A' or k=='C' or k=='G' or k=='T'):
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:j+1]))
print(ans)
Buggy code:
s=str(input())

lens=len(s)
ans=0
list=[]

for i in range(lens):
	if (s[i]=='A')|(s[i]=='T')|(s[i]=='C')|(s[i]=='G'):
		ans=ans+1
	else:
		list.append(ans)
		ans=0
list.append(ans)

print(list)
print(max(list))

Fixed code:
s=str(input())

lens=len(s)
ans=0
list=[]

for i in range(lens):
	if (s[i]=='A')|(s[i]=='T')|(s[i]=='C')|(s[i]=='G'):
		ans=ans+1
	else:
		list.append(ans)
		ans=0
list.append(ans)
print(max(list))
Buggy code:
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if all(c in 'ATCG' for c in s[i:j]):
            ans += 1

print(ans)


Fixed code:
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        if all(c in 'ATCG' for c in s[i:j]):
            ans = max(ans, j - i)

print(ans)
Buggy code:
s = input()
l = 0
l_max = 0
for i in range(len(s)):
  b = S[i]
  if b == 'A' or b == 'C' or b == 'T' or b == 'G':
    l += 1
  else:
    l_max = max(l_max,l)
    l = 0
print(l_max)

Fixed code:
s = input()
l = 0
l_max = 0
for i in range(len(s)):
  b = s[i]
  if b == 'A' or b == 'C' or b == 'T' or b == 'G':
    l += 1
  else:
    l_max = max(l_max,l)
    l = 0
l_max = max(l_max,l)
print(l_max)
Buggy code:
s=input()
a=0
for i in s:
  if i in ATGC:
    a+=1
  else:
    b=a
    a=0
print(max(a,b))

Fixed code:
s=input()
a=0
b=0
for i in s:
  if i in "ATGC" :
    a+=1
  else:
    b=max(a,b)
    a=0
print(max(a,b))
Buggy code:
str = input()
maxans = []
ans = []

for j in range(0,len(str)):
  for i in range(j,len(str)):
    print(str[i])
    if str[i] == 'A' or str[i] == 'C' or str[i] == 'G' or str[i] == 'T':
      ans.append(str[i])
    else:
      break
  if len(ans) >= len(maxans):
    maxans = ans
  ans = []
      
print(maxans)
print(len(maxans))

Fixed code:
str = input()
maxans = []
ans = []

for j in range(0,len(str)):
  for i in range(j,len(str)):
    if str[i] == 'A' or str[i] == 'C' or str[i] == 'G' or str[i] == 'T':
      ans.append(str[i])
    else:
      break
  if len(ans) >= len(maxans):
    maxans = ans
  ans = []
      
print(len(maxans))
Buggy code:
s = input()
s = s.translate(str.maketrans({'T': 'A', 'G': 'A', 'C': 'A'}))
print(s)
s = list(s)+['END']

if s[0] == 'A':
    counter = 1
else:
    counter = 0

ans = 0

for i in range(len(s)):
    if s[i - 1] == s[i] == 'A':
        counter += 1
    else:
        if ans < counter:
            ans = counter
        if s[i] == 'A':
            counter = 1
        else:
            counter = 0
print(ans)


Fixed code:
s = input()
s = s.translate(str.maketrans({'T': 'A', 'G': 'A', 'C': 'A'}))
s = list(s)+['END']

if s[0] == 'A':
    counter = 1
else:
    counter = 0

ans = 0

for i in range(len(s)):
    if s[i - 1] == s[i] == 'A':
        counter += 1
    else:
        if ans < counter:
            ans = counter
        if s[i] == 'A':
            counter = 1
        else:
            counter = 0
print(ans)
Buggy code:
s = input()
ans = 0, cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)

Fixed code:
s = input()
ans = 0
cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)
Buggy code:
S=input()
ACGT=['A','C','G','T']
ans=[]
k=0
while k<len(S):
    num=0
    if S[k] in ACGT:
        num=1
        for i in range(1,len(S)-k):
            if S[k+i] in ACGT:
                num+=1
            else:
                break
    ans.append(num)
    k=+num

print(max(ans))

Fixed code:
S=input()
ACGT=['A','C','G','T']
ans=[0]
k=0
while k<len(S):
    num=0
    if S[k] in ACGT:
        num=1
        for i in range(1,len(S)-k):
            if S[k+i] in ACGT:
                num+=1
            else:
                break
        ans.append(num)
    else:
        num=1
    k+=num

print(max(ans))
Buggy code:
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S), reverse=True, key=len)
print(ans[0])

Fixed code:
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(len(ans[0]))
Buggy code:
s=input()
n=len(s)
list=["A","C","G","T"]
new=[]
a=0
for i in range(n):
  if s[i] in list:
    a+=1
    if i == n-1:
      new.append(a)
  if s[i] not in list:
    new.append(a)
    a=0
print(new)


Fixed code:
s=input()
n=len(s)
list=["A","C","G","T"]
new=[]
a=0
for i in range(n):
  if s[i] in list:
    a+=1
    if i == n-1:
      new.append(a)
  if s[i] not in list:
    new.append(a)
    a=0
print(max(new))
Buggy code:
ACGT = ['A', 'C', 'G', 'T']


def not_acgt(s):
    for c in s:
        if c not in ACGT:
            return False

    return True


def main():
    S = input()

    results = []
    # all_results = []
    for i in range(len(S)):
        for j in range(len(S)):
            if not_acgt(S[i:j]):
                results.append(S[i:j+1])
            # all_results.append(S[i:j+1])

    print(max([len(s) for s in results]))


if __name__ == "__main__":
    main()


Fixed code:
ACGT = ['A', 'C', 'G', 'T']


def not_acgt(s):
    for c in s:
        if c not in ACGT:
            return False

    return True


def main():
    S = input()

    results = []
    # all_results = []
    for i in range(len(S)):
        for j in range(len(S)):
            if not_acgt(S[i:j+1]):
                results.append(S[i:j+1])
            # all_results.append(S[i:j+1])
    try:
        print(max([len(s) for s in results]))
    except Exception:
        print(0)


if __name__ == "__main__":
    main()
Buggy code:
src = input()
length = len(src)
acgt = set("ACGT")
ans = 0
for i in range(length):
    n = length - i
    for ngram in [src[k:k+n] for k in range(length - n + 1)]:
        print(ngram)
        subtract = len(set(ngram) - acgt)
        if subtract == 0:
            ans = n
            break
    if ans != 0:
        break
print(ans)

Fixed code:
src = input()
length = len(src)
acgt = set("ACGT")
ans = 0
for i in range(length):
    n = length - i
    for ngram in [src[k:k+n] for k in range(length - n + 1)]:
        subtract = len(set(ngram) - acgt)
        if subtract == 0:
            ans = n
            break
    if ans != 0:
        break
print(ans)
Buggy code:
list_original=input()
box=list(list_original)
MAX = 0
count = 0
flag = 0
for figure in box:
  if figure == 'A' or figure =='G' or figure =='C' or figure == 'G':
    flag = 1
  else:
    flag = 0
    count = 0
  if flag == 1:
    count += 1
  if count > MAX:
    MAX =count
print(MAX)

Fixed code:
list_original=input()
box=list(list_original)
MAX = 0
count = 0
flag = 0
for figure in box:
  if figure == 'A' or figure =='T' or figure =='C' or figure == 'G':
    flag = 1
  else:
    flag = 0
    count = 0
  if flag == 1:
    count += 1
  if count > MAX:
    MAX = count
print(MAX)
Buggy code:
s=str(input())
ans=0
cnt=0
for i in range(len(s)):
  if s[i]=='A' or 'G' or 'C' or 'T':
    cnt++
  else:
    ans=max(ans, cnt)
    cnt=0
print(ans)

Fixed code:
s=str(input())
ans=0
cnt=0

for i in range(len(s)):
  
  if s[i]=="A" or s[i]== "G" or s[i]== "C" or s[i]== "T":
    cnt=cnt+1
    ans=max(ans, cnt)
    
  else:
    cnt=0
    
print(ans)
Buggy code:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0

for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
    if i+1 == len(st):
        count.append(temp)
        
print(st)
if count:
    print(max(count))
else:
    print(0)

Fixed code:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0

for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
    if i+1 == len(st):
        count.append(temp)
        
#print(st)
if count:
    print(max(count))
else:
    print(0)
Buggy code:
n = input()

tmp = 0
count = 0
for i in n:
    print(i)
    if i == "A" or i == "C" or i == "G" or i == "T":
        count+=1
    else:
        print(tmp,count)
        tmp = max(tmp,count)
        count=0
if tmp == 0:
    print(count)
else:
    print(tmp)

Fixed code:
n = input()

tmp = 0
count = 0
for i in n:
    if i == "A" or i == "C" or i == "G" or i == "T":
        count+=1
    else:
        tmp = max(tmp,count)
        count=0
print(max(tmp,count))
Buggy code:
s=input()
count=0
count_list=[]
seq=["A","T","G","C"]
for base in ref:
    if base in seq:
        count +=1
    else:
        count_list.append(count)
        count = 0
    count_list.append(count)
print(max(count_list))

Fixed code:
s=input()
count=0
count_list=[]
seq=["A","T","G","C"]
for base in s:
    if base in seq:
        count +=1
    else:
        count_list.append(count)
        count = 0
    count_list.append(count)
print(max(count_list))
Buggy code:
s = input()
sl = len(s)
dic = {"A":1,"C":1,"G":1,"T":1}
cntmax = 0
for i in range(sl):
    cnt=0    
    for j in range(sl):
        try :
            cnt += dic[s[j]]
        except KeyError:
            if cntmax < cnt:
                print(str(i)+" "+str(j)+" "+str(cntmax)+" "+str(cnt))
                cntmax = cnt
print(cntmax)


Fixed code:
s = input()
sl = len(s)
dic = {"A":1,"C":1,"G":1,"T":1}
cntmax = 0
for i in range(sl):
    cnt=0    
    for j in range(i,sl):
        try :
            # print(str(cnt) +" "+ s[j])
            cnt += dic[s[j]]
        except KeyError:
            # print(s[j])
            if cntmax < cnt:
                # print(str(i)+" "+str(j)+" "+str(cntmax)+" "+str(cnt))
                cntmax = cnt
            break
    if cntmax < cnt:
        cntmax = cnt
print(cntmax)
Buggy code:
S = list(input())
n = len(S)
m = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        print(S[i:j], j - i)
        if j - i > m and all(s in "ACGT" for s in S[i:j]):
            m = j - i
print(m)

Fixed code:
S = list(input())
n = len(S)
m = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        if j - i > m and all(s in "ACGT" for s in S[i:j]):
            m = j - i
print(m)
Buggy code:
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
  else:
    break
print(len(max_acgt))

Fixed code:
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
  else:
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
    acgt_list = list()
print(len(max_acgt))
Buggy code:
S = input()
x=[]
t=0
c=[0]
for s in S:
  x.append(s)
for i in range(len(x)):
  if x[i]=="A" or x[i]=="T" or x[i]=="C" or x[i]=="G":
    t+=1
    print(i)
    print(t)
  else:
    c.append(t)
    t=0
    print(i)
    print(t)
c.append(t)
print(max(c))

Fixed code:
S = input()
x=[]
t=0
c=[0]
for s in S:
  x.append(s)
for i in range(len(x)):
  if x[i]=="A" or x[i]=="T" or x[i]=="C" or x[i]=="G":
    t+=1
  else:
    c.append(t)
    t=0
c.append(t)
print(max(c))
Buggy code:
s = input()

c = 0
m = 0
for i in s:
	if s in 'ACGT':
		c += 1
		m = max(c,m)
    else:
		c = 0

print(m)

Fixed code:
s = input()

c = 0
m = 0
for i in s:
	if i in 'ACGT':
		c += 1
		m = max(c,m)
	else:
		c = 0

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

L = []
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        
max(L)

Fixed code:
s = list(input())

L = []
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        cnt = 0
L.append(cnt)

print(max(L))
Buggy code:
N=list(input())
print(N)
count = 0
Scount = 0

for i in N:
  if i == "A" or i == "C" or  i == "G" or  i == "T":
    count += 1
    Scount = max(Scount,count)
  else:
    count = 0

print(Scount)

Fixed code:
N=list(input())
count = 0
Scount = 0

for i in N:
  if i == "A" or i == "C" or  i == "G" or  i == "T":
    count += 1
    Scount = max(Scount,count)
  else:
    count = 0

print(Scount)
Buggy code:
s=input()
ans=0
for i in range(len(s)):
  l=0
  for j in range(i:len(s)):
    if s[j] in ["A","T","G","C"]:
      l+=1
    else:
      break
  ans=max(ans,l)
print(ans)

Fixed code:
s=input()
ans=0
for i in range(len(s)):
  l=0
  for j in range(i,len(s)):
    if s[j] in ["A","T","G","C"]:
      l+=1
    else:
      break
  ans=max(ans,l)
print(ans)
Buggy code:
S = input()
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)

Fixed code:
S = input()
N = len(S)
ans = 0
for i in range(N):
	for j in range(i, N):
		if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
			ans = max(ans, j - i + 1)
print(ans)
Buggy code:
s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
for i in ans:
    if list(set(i)) == d:
        x.append(len(i))
    else:
        pass
print(max(x))

Fixed code:
s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
for i in ans:
    if set(i) <= set(d):
        x.append(len(i))
    else:
        pass
if x:
  print(max(x))
else:
  print(0)
Buggy code:
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

max = max(re.findall('[A|T|G|C]+', S)) if re.findall('[A|T|G|C]+', S) else 0
if max > 0:max
print(max)

Fixed code:
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

result = 0
max = max(re.findall('[A|T|G|C]+', S),key=len) if re.findall('[A|T|G|C]+', S) else ''
if len(max) > 0:result = len(max)
print(result)
Buggy code:
s = list(input())
ctn = 0
for i in s:
    if i in ['A', 'G', 'C', 'T']:
        ctn += 1
        m = max(m, ctn)
    else:
        ctn = 0
print(ctn)

Fixed code:
s = list(input())
ctn = 0
m = 0
for i in s:
    if i in ['A', 'C', 'G', 'T']:
        ctn += 1
        m = max(m, ctn)
    else:
        ctn = 0
print(m)
Buggy code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
count = 0
max_count = 0
for w in S:
    if w in ACGT:
        count += 1
    else:
        if count > max_count:
            max_count += count
print(max_count

Fixed code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
count = 0
max_count = 0
for w in S:
    if w in ACGT:
        count += 1
    if count > max_count:
        max_count = count
    if w not in ACGT:
        count = 0
print(max_count)
Buggy code:
S = input()
gene = ['A','T','C','G']

length = len(S)
ans = 0
tmp = 0

for i in range(length):
  if s[i] in gene:
    tmp += 1
  else:
    tmp = 0
  if tmp >= ans:
    ans = tmp
print(ans)
      

Fixed code:
S = input()
gene = ['A','T','C','G']

length = len(S)
ans = 0
tmp = 0

for i in range(length):
  if S[i] in gene:
    tmp += 1
  else:
    tmp = 0
  if tmp >= ans:
    ans = tmp
print(ans)
Buggy code:
S = list(input())

c = 0
ans = 0

for i in S:
    if i=='A' or i=='C' or i=='G' or i=='T':
        c += 1
        if ans < c:
        ans = c
    else:
        c = 0

print(ans)

Fixed code:
S = list(input())

c = 0
ans = 0

for i in S:
    if i=='A' or i=='C' or i=='G' or i=='T':
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0

print(ans)
Buggy code:
S = input()
ACGT = ["A","C","G","T"]
 
count=0
ans=0
 
for i in range(len(S)):
    if S[i] in ACGT:
        count+=1
    else:
        ans=max(ans,count)
 
ans=max(ans,count)
print(ans)

Fixed code:
S = input()
ACGT = ["A","C","G","T"]
 
count=0
ans=0
 
for i in range(len(S)):
    if S[i] in ACGT:
        count+=1
    else:
        ans=max(ans,count)
        count=0
ans=max(ans,count)
print(ans)
Buggy code:
a=input()+"o"
b=["A","T","C","G"]
ans=0
c=0
for i in range(len(a)):
  if a[i] in b:
    print(i)
    c+=1
  else:
    if c>ans:
      ans=c
    c=0
print(ans)

Fixed code:
a=input()+"o"
b=["A","T","C","G"]
ans=0
c=0
for i in range(len(a)):
  if a[i] in b:
    c+=1
  else:
    if c>ans:
      ans=c
    c=0
print(ans)
Buggy code:
N = list(input())
print(N)
m = 0
cnt = 0
for x in N:
    
    if x == 'A' or x == 'C' or x == 'G' or x == 'T':
        cnt += 1
    else:
        m = max(cnt, m)
        cnt = 0

m = max(cnt, m)

print(m)

Fixed code:
N = list(input())
m = 0
cnt = 0
for x in N:
    
    if x == 'A' or x == 'C' or x == 'G' or x == 'T':
        cnt += 1
    else:
        m = max(cnt, m)
        cnt = 0

m = max(cnt, m)

print(m)
Buggy code:
s = input()
SENT = ('A','T','G','C')

ans = 0
count = 0
for c in s:
  if c in SENT:
    count += 1
  else:
    ans = max(ans,conut)
    count = 0
else:
  ans = max(ans,count)
  
print(ans)

Fixed code:
s = input()
SENT = ('A','T','G','C')

ans = 0
count = 0
for c in s:
  if c in SENT:
    count += 1
  else:
    ans = max(ans,count)
    count = 0
else:
  ans = max(ans,count)
  
print(ans)
Buggy code:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc) and flag:
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)

Fixed code:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc):
    flag = True
    if not flag:
      count = 0
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)
Buggy code:
S = input()
maxlength = 0
length = 0
for i in S:
  if i in 'ATGC':
    length += 1
  else:
    length =0
  maxlength = max(maxlength, length)

Fixed code:
S = input()
maxlength = 0
length = 0
for i in S:
  if i in 'ATGC':
    length += 1
  else:
    length =0
  maxlength = max(maxlength, length)
print (maxlength)
Buggy code:

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(max_count, count)
    else:
        count = 0

print(ans)

Fixed code:

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)
Buggy code:
if __name__ =='__main__':
    s = input()
    ans = 0
    seq = 0
    for c in s:
        if c=='A' or c=='T' or c=='G' or c=='C':
            seq+=1
        else:
            ans = max(ans,seq)
    ans = max(ans,seq)
    print(ans)

Fixed code:

def main():
    s = input()
    ans = 0
    seq = 0
    for c in s:
        if c == 'A' or c == 'C' or c == 'T' or c == 'G':
            seq+=1
        else:
            ans = max(ans,seq)
            seq=0
    else:
        ans = max(ans,seq)
    print(ans)

if __name__ == '__main__':
    main()
Buggy code:
s=input()
n=len(s)
list=['A','C','G','T']
ans=[]
for i in range(n):
  k=0
  while i+k<=n-1:
    if all(a in list for a in s[i:i+k+1]):
      ans.append(k+1)
    k+=1
print(max(ans))

Fixed code:
s=input()
n=len(s)
list=['A','C','G','T']
ans=[]
for i in range(n):
  k=0
  while i+k<=n-1:
    if all(a in list for a in s[i:i+k+1]):
      ans.append(k+1)
    k+=1
if len(ans)==0:
  print(0)
else:
  print(max(ans))
Buggy code:
s = list(input())
renzoku = 0
renli = []
for i in s:
    if i == "A" or i == "T" or i == "C" or i == "G":
        renzoku += 1
        renli.append(renzoku)
    else:
        renzoku = 0
print(max(renli))

Fixed code:
s = list(input())
renzoku = 0
count = 0
hu_renzoku = 0
renli = []
for i in s:
    count += 1
    if i == "A" or i == "T" or i == "C" or i == "G":
        renzoku += 1
        renli.append(renzoku)
    else:
        renzoku = 0
        hu_renzoku += 1
if count == hu_renzoku:
    print(0)
else:
    print(max(renli))
Buggy code:
S = list(input())
N = len(S)
M = ["A","G" ,"C" ,"T"]

cnt = 0
Ans = 0
for i in range(N):
    if S[i] in M:
        cnt += 1
        Ans = max(Ans, cnt)
    else:
        Ans = max(Ans, cnt)
print(Ans)

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

cnt = 0
Ans = 0
for i in range(N):
    if S[i] in M:
        cnt += 1
        Ans = max(Ans, cnt)
    else:
        Ans = max(Ans, cnt)
        cnt = 0
print(Ans)
Buggy code:
s = input()
ans = 0
tmp = 0
acgt = ['A', 'C', 'G', 'T']
while s:
  if s.pop(0) in acgt:
    tmp += 1
  else:
    ans = max([ans, tmp])
    tmp = 0

ans = max([ans, tmp])
print(ans)

Fixed code:
s = [i for i in input()]
ans = 0
tmp = 0
acgt = ['A', 'C', 'G', 'T']
while s:
  if s.pop(0) in acgt:
    tmp += 1
  else:
    ans = max([ans, tmp])
    tmp = 0

ans = max([ans, tmp])
print(ans)
Buggy code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
  else:
    if(len(b)>len(c)):
      c = b
      b = ""
print(c)

Fixed code:
a = list(input())
b = 0
c = 0

for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += 1
    if(b > c):
      c = b
  else:
    b = 0

print(c)