qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s = input()
ml = 0
nc = 0
for c in s:
    if c in "ACGT": 
        nc += 1
    else:
        ml = max(ml, nc)
        nc = 0


Fixed code:
s = input()
ml = 0
nc = 0
for c in s:
    if c in "ACGT": 
        nc += 1
    else:
        ml = max(ml, nc)
        nc = 0
ml = max(ml, nc)
print(ml)
Buggy code:
import re

S = input()

pattern = "[A|T|G|C]+"
match_result = re.findall(pattern, S)

ans = 0
for word in match_result:
    if ans <= len(word): ans = len(word)


Fixed code:

import re

S = input()

pattern = "[A|T|G|C]+"
match_result = re.findall(pattern, S)

ans = 0
for word in match_result:
    if ans <= len(word): ans = len(word)

print(ans)
Buggy code:
X = list(input())
#print(X)
ans=0
anss=[]
for i in X:
  if i in ['A','C','G','T']:
    ans+=1
    anss.append(ans)
  else:
    break
ans = 0
  
if anss:
  print(max(anss))
else:    
  print(0)    

Fixed code:
X = list(input())
#print(X)
ans=0
anss=[]
for i in X:
  if i in ['A','C','G','T']:
    ans+=1
#    print(i)
  else:
    ans = 0
  anss.append(ans)

if anss:
  print(max(anss))
else:    
  print(0)
Buggy code:
S = input()
ans = [0] * (len(S) + 1)
for i in range(len(S)):
  if S[i] not in "ATCG": continue
  ans[i+1] += ans[i]
print(max(ans))

Fixed code:
S = input()
ans = [0] * (len(S) + 1)
for i in range(len(S)):
  if S[i] not in "ATCG": continue
  ans[i+1] = ans[i] + 1
print(max(ans))
Buggy code:
S = input()

ns = []
for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
print(max(ns))

Fixed code:
S = input()

ns = [0]
n = 0

for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
ns.append(n)

print(max(ns))
Buggy code:
S = input()
H = re.findall("[ACGT]+", S)
max_length = 0
for h in H:
	if max_length < len(h):
		max_length = len(h)
print(max_length)

Fixed code:
import re
S = input()
H = re.findall("[ACGT]+", S)
max_length = 0
for h in H:
	if max_length < len(h):
		max_length = len(h)
print(max_length)
Buggy code:
s=input()

score=0

for i in range(len(s)-1):
    for j in range(i+1,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            print(s[i:j+1])
        
print(score)

Fixed code:
s=input()

score=0

for i in range(len(s)):
    for j in range(i,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            # print(s[i:j+1])
        
print(score)
Buggy code:
S = input()
acgt = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S), 0, -1):
    for j in range(len(S) - i + 1):
        for k, s in enumerate(S[j:i + j]):
            print(S[j:i + j])
            if not s in acgt:
                break
            if k == len(S[j:i + j]) - 1:
                ans = len(S[j:i + j])
            
        if ans != 0:
            break
    else:
        continue
   
    break    
    
print(ans)

Fixed code:
S = input()
acgt = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S), 0, -1):
    for j in range(len(S) - i + 1):
        for k, s in enumerate(S[j:i + j]):
            if not s in acgt:
                break
            if k == len(S[j:i + j]) - 1:
                ans = len(S[j:i + j])
            
        if ans != 0:
            break
    else:
        continue
   
    break    
    
print(ans)
Buggy code:
S = input()

max_len = 0
memo_len = 0
flag = True

for i in range(len(S)):
    if S[i]=="A" or S[i]=="T" or S[i]=="G" or S[i]=="C":
        if flag == True:
            memo_len += 1
        else:
            max_len = memo_len
            memo_len = 1
            flag = True
    else:
        flag = False
        

print(max_len)

Fixed code:
S = input()

max_len = 0
memo_len = 0
flag = True

for i in range(len(S)):
    if S[i]=="A" or S[i]=="T" or S[i]=="G" or S[i]=="C":
        if flag == True:
            memo_len += 1
        else:
            memo_len = 1
            flag = True
    else:
        if max_len < memo_len:
            max_len = memo_len
        flag = False
        
if max_len < memo_len:
    max_len = memo_len
print(max_len)
Buggy code:
S = input()

cnt = 0
ans = 0

for ss in S:
    if ss in 'ACGT':
        len += 1
    else:
        len = 0
    ans = max(ans,len)
    
print(ans)

Fixed code:
S = input()

cnt = 0
ans = 0

for ss in S:
    if ss in 'ACGT':
        cnt += 1
    else:
        cnt = 0
    ans = max(ans,cnt)
    
print(ans)
Buggy code:
s=input()
count=0
a=0
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        count+=1
        if a<count:
            a=count
        else:
            count=0
print(a)

Fixed code:
s=input()
count=0
a=0
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        count+=1
        if a<count:
            a=count
    else:
        count=0
print(a)
Buggy code:
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N+1):
    for j in range(N+1):
        s=S[i:j]
        print(s)
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)

Fixed code:
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N+1):
    for j in range(N+1):
        s=S[i:j]
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)
Buggy code:
S = input()
L = 0
max_L = 0

for i in len(S):
  s = S[i]
  TF = any(['A'==s, 'C'==s, 'G'==s, 'T'==s])
  if TF:
    L += 1
  elif L >= max_L:
    max_L = L
    L = 0

print(max_L)

Fixed code:
S = input()
L = 0
max_L = 0
 
for i in range(len(S)):
  s = S[i]
  TF = any(['A' in s, 'C' in s, 'G' in s, 'T' in s])
  if TF:
    L += 1
    if L >= max_L:
        max_L = L
  elif L >= max_L:
    max_L = L
    L = 0

print(max_L)
Buggy code:
import re

S = input()
ans = re.split(r'[^ATGC]', S)

maxlen = -1
maxarg = 0
for i,a in enumerate(ans):
    if len(a) > maxlen:
        maxlen = len(a)
        maxarg = i
print(ans[maxarg])



Fixed code:
import re

S = input()
ans = re.split(r'[^ATGC]', S)

maxlen = -1
maxarg = 0
for a in ans:
    maxlen = len(a) if len(a) > maxlen else maxlen

print(maxlen)
Buggy code:
s=input()
l = []
cnt = 0
for i in s:
    if i =='A'or i == 'C' or i == 'G' or i == 'T':
        cnt +=1
        l.append(cnt)
    else:
        cnt = 0
print(max(l))

Fixed code:
s=input()
l = [0]
cnt = 0
for i in s:
    if i =='A'or i == 'C' or i == 'G' or i == 'T':
        cnt +=1
        l.append(cnt)
    else:
        cnt = 0
print(max(l))
Buggy code:
s =str(input())
ans = 0
aa = []
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
print(max(aa))

Fixed code:
s =str(input())
ans = 0
aa = []
if s[0] in ['A', 'C', 'G', 'T']:
    ans =1
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
aa.append(ans)
print(max(aa))
Buggy code:
S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]))

Fixed code:
S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]+[0]))
Buggy code:
seq = input()
index = []
for char in list(seq):
    if char == "A" or char == "T" or char == "C" or char == "C":
        index.append("1")
    else:
        index.append("0")
index2 = ''.join(index)
print(len(max(index2.split("0"))))

Fixed code:
seq = input()
index = []
for char in list(seq):
    if char == "A" or char == "T" or char == "C" or char == "G":
        index.append("1")
    else:
        index.append("0")
index2 = ''.join(index)
print(len(max(index2.split("0"))))
Buggy code:
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i,j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)

Fixed code:
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i:j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)
Buggy code:
def readln():
    return list(map(int, input().split()))


S = input()
ans = 0
for s in S:
    if s == 'A' or s == 'T' or s == 'C' or s == 'G':
        ans += 1
print(ans)


Fixed code:
def readln():
    return list(map(int, input().split()))


S = input()
tmp = 0
ans = 0
for s in S:
    if s == 'A' or s == 'T' or s == 'C' or s == 'G':
        tmp += 1
        ans = max(tmp, ans)
    else:
        tmp = 0

print(ans)
Buggy code:
import sys
input = sys,sydin.readline

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      ans = max(ans, count)
      break
  
print(ans)

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

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    ans = max(ans, count)
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      break
  
print(ans)
Buggy code:
S = input()

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

num_list = [0]
for i in range(len(S)):
  if S[i] not in ACGT:
    num_list.append(i)

num_list.append(len(S)+1)

dif_list = []
for i in range(len(num_list)-1):
  dif_list.append(num_list[i+1]-num_list[i])
  
print(max(dif_list)-1)

Fixed code:
S = input()

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

num_list = [-1]
for i in range(len(S)):
  if S[i] not in ACGT:
    num_list.append(i)

num_list.append(len(S))

dif_list = []
for i in range(len(num_list)-1):
  dif_list.append(num_list[i+1]-num_list[i])
  
print(max(dif_list)-1)
Buggy code:
S = input()
start = 0
max = 0
count = 0
for i in range(len(S)):
    if(S[i] != "A")&(S[i] != "T")&(S[i] != "G")&(S[i] != "C"):
        if max < count:
            max = count
        count = 0
    else:
        count = count + 1
        if (S[i] == "A")|(S[i] == "T")|(S[i] == "G")|(S[i] == "C")&(max < count):
            max = count
print(max)

Fixed code:
S = input()
start = 0
max = 0
count = 0
for i in range(len(S)):
    if(S[i] != "A")&(S[i] != "T")&(S[i] != "G")&(S[i] != "C"):
        if max < count:
            max = count
        count = 0
    else:
        count = count + 1
if ((S[i] == "A")|(S[i] == "T")|(S[i] == "G")|(S[i] == "C"))&(max < count):
    max = count
print(max)
Buggy code:
s = str(input())
mx = 0
for i in range(n):
    for j in range(i+1,n+1):
        cnt = j-i-1
        p = 0
        for k in list(s[i:j]):
            if k in ["A","C","G","T"]:
                p += 1
        if p == cnt:
            if p > mx:
                mx = p
print(mx)

Fixed code:
s = str(input())
mx = 0
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        cnt = j-i
        p = 0
        for k in list(s[i:j]):
            if k in ["A","C","G","T"]:
                p += 1
        if p == cnt:
            if p > mx:
                mx = p
print(mx)
Buggy code:
s=list(map(str,input()))
for i in range(len(s)):
    s[i]='1' if (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T') else '0'
len(max(''.join(s).split('0'),key=len))

Fixed code:
s=list(map(str,input()))
for i in range(len(s)):
    s[i]='1' if (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T') else '0'
print(len(max(''.join(s).split('0'),key=len)))
Buggy code:
def checkACGT(s):
    ss = ''.join(s)
    check = ss.replace('A', '').replace('C', '')\
    .replace('G','').replace('T', '')
    if len(check) == 0:
        print(ss)
        return True

    else:
        return False


s = input()
ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        ss = s[i:j + i]
        # print(ss)
        if (checkACGT(ss)):
            ans = max(ans, len(ss))
print(ans)


Fixed code:
def checkACGT(s):
    ss = ''.join(s)
    check = ss.replace('A', '').replace('C', '')\
    .replace('G','').replace('T', '')
    if len(check) == 0:
        return True
    else:
        return False


s = input()
ans = 0
for i in range(len(s)):
    for j in range(len(s) - i + 1):
        ss = s[i:j + i]
        # print(ss)
        if (checkACGT(ss)):
            ans = max(ans, len(ss))
print(ans)
Buggy code:
S=input()
flag=0
count=0
begin=0
max_begin=0
max_count=0
for i in range(len(S)):
    if flag==0:
        
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            begin=i
            count+=1
            flag=1
            
    else:
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            count+=1
        else:
            if max_count<count:
                max_count=count
                max_begin=begin
            flag=0
            count=0
print(S[max_begin:max_count])    

Fixed code:
S=input()
flag=0
count=0
begin=0
max_begin=0
max_count=0
for i in range(len(S)):
    if flag==0:
        
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            begin=i
            count+=1
            flag=1
            
    else:
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            count+=1
            
        else:
            if max_count<count:
                max_count=count
                max_begin=begin
            flag=0
            count=0
if max_count<count:
    max_count=count
print(max_count)
Buggy code:
s=input()
def che(s):
  for c in s:
    if c=='A' or c=='C' or c=='G' or c=='T':
      pass
    else:
      return 0
  return 1
mx=""
for i in range(0,len(s)+1):
  for j in range(0, len(s)+1):
    com=s[i:j]
    if len(com)==0:
      continue
    if len(mx)<len(com) and che(com):
      mx=com
print(mx)

Fixed code:
s=input()
def che(s):
  for c in s:
    if c=='A' or c=='C' or c=='G' or c=='T':
      pass
    else:
      return 0
  return 1
mx=""
for i in range(0,len(s)+1):
  for j in range(0, len(s)+1):
    com=s[i:j]
    if len(com)==0:
      continue
    if len(mx)<len(com) and che(com):
      mx=com
print(len(mx))
Buggy code:
s = input()
ans = 0
l = 0
for c in s:
  if c == 'A' || c == 'C' || c == 'G' || c == 'T':
    l += 1
  else:
    ans = max(ans, l)
    l = 0
ans = max(ans, l)
print(ans)


Fixed code:
s = input()
ans = 0
l = 0
for c in s:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    l += 1
  else:
    ans = max(ans, l)
    l = 0
ans = max(ans, l)
print(ans)
Buggy code:
code = input()
read_code = list(code)
count = 0

for i in range(0, len(read_code)):
    code_count = False
    if read_code[i] == "A" or read_code[i] == "C" or read_code[i] == "G" or read_code[i] == "T":
        code_count = True
    else:
        code_count = False

    if(code_count == True):
        count += 1

print(count)


Fixed code:
code = input()
read_code = list(code)
count = 0
count_end = 0

for i in range(0, len(read_code)):
    code_count = False
    if read_code[i] == "A" or read_code[i] == "C" or read_code[i] == "G" or read_code[i] == "T":
        count += 1
        if(count >= count_end):
            count_end = count
    else:
        count = 0

print(count_end)
Buggy code:
s = input()
count = 0
result = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        count += 1
        if count >= result:
            result = count
print(result)

Fixed code:
s = input()
count = 0
result = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        count += 1
        if count >= result:
            result = count
    else:
        count = 0
print(result)
Buggy code:
S = input()
cnt = 0
cntmax = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        cnt+=1
        if cnt>cntmax:
            cntmax = cnt

print(cntmax)

Fixed code:
S = input()
cnt = 0
cntmax = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        cnt+=1
        if cnt>cntmax:
            cntmax = cnt
    else:
        cnt = 0

print(cntmax)
Buggy code:
S = input()
l = re.findall(r'[ACGT]+', S)
if l:
  print(max(map(len, l)))
else:
  print(0)


Fixed code:
import re

S = input()
l = re.findall(r'[ACGT]+', S)
if l:
  print(max(map(len, l)))
else:
  print(0)
Buggy code:
S = input()
S = list(S)
cnt = 0
maxcount = 0
print(S)

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 cnt > maxcount:
            maxcount = cnt
    else:
        cnt = 0
print(maxcount)

Fixed code:
S = input()
S = list(S)
cnt = 0
maxcount = 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 cnt > maxcount:
            maxcount = cnt
    else:
        cnt = 0
print(maxcount)
Buggy code:
S = input()

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


max_l = 0

for i in range(len(S)):
    if S[i] in acgt:
        l = 1
        for j in range(i+1, len(S)):
            if S[j] in acgt:
                l+=1
            else:
                continue
        if l > max_l:
            max_l = l
print (max_l)


Fixed code:
S = input()

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


max_l = 0

for i in range(len(S)):
    l = 0
    for j in range(i, len(S)):
        if S[j] in acgt:
            l+=1
        else:
            break
    if l > max_l:
        max_l = l
print (max_l)
Buggy code:
s = input()
res = 0
for i in range(len(s)):
    cnt = 0
    while s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt += 1
        i += 1
    res = max(res,cnt)
print(res)

Fixed code:
s = input()
res = 0
for i in range(len(s)):
    cnt = 0
    while s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt += 1
        i += 1
        if i==len(s):
          break
    res = max(res,cnt)
print(res)
Buggy code:
N = list(input())
for i in range(len(N)):
  if N[i] in'ACGT':
    N[i] += 1
    N[i+1] = N[i]
  else:
    N[i] = 0
print(max(N))

Fixed code:
N = list(input())
dp = [0]*(len(N)+1)
for i in range(len(N)):
  if N[i] in'ACGT':
    dp[i] += 1
    dp[i+1] = dp[i]
  else:
    dp[i] = 0
print(max(dp))
Buggy code:
s = input()
l = []
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
        #print(cnt)
        if i == len(s) - 1:
            l.append(cnt)
            
        
        
        
    elif i != "A" or i !="C" or i != "G" or i != "T":
        l.append(cnt)

print(max(l))

Fixed code:
s = input()
l = []
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
        #print(i, cnt)
        if i == len(s) - 1:
            l.append(cnt)
            
        
        
        
    elif i != "A" or i !="C" or i != "G" or i != "T":
        l.append(cnt)
        cnt = 0
        #print("y")
print(max(l))
Buggy code:
import re
ptn = re.compile(r"(A|C|T|G)*")

S = input()
T = set()
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1])
    if(x.group(0)):
      T.add(len(x.group(0)))
print(max(T))

Fixed code:
import re
ptn = re.compile(r"(A|C|T|G)*")

S = input()
T = set()
xx=ptn.match("FAFA")
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1])
    if(x.group(0)):
      T.add(len(x.group(0)))
try:
  print(max(T))
except:
  print(0)
Buggy code:
s=list(input())
cnt=0
ans=0
lis=list("ATCG")

for i in s:
  if s[i] in lis:
    cnt+=1
    ans=max(ans,cnt)
  else:
    cnt=0
print(ans)

Fixed code:
s=list(input())
cnt=0
ans=0
lis=list("ATCG")

for i in s:
  if i in lis:
    cnt+=1
    ans=max(ans,cnt)
  else:
    cnt=0
print(ans)
Buggy code:
S = input()
N = len(S)
ans =0
for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        if len(tmp)==S.count('A')+S.count('G')+S.count('C')+S.count('T'):
            ans = max(ans,len(tmp))
print(ans)

Fixed code:
S = input()
N = len(S)
ans =0
for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        if len(tmp)==tmp.count('A')+tmp.count('G')+tmp.count('C')+tmp.count('T'):
            ans = max(ans,len(tmp))
print(ans)
Buggy code:
n = input()
count=0
m = 0
for i in n:
  if s =="A" or s == "C" or s == "G" or s== "T" :
    count+=1
  else:
    m =max(m,count)
    count=0
print(m)

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

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

Fixed code:
a=''.join([i if i in ['A', 'C', 'G', 'T'] else ' ' for i in input()])
print(len(max(a.split() + [''], key=len)))
Buggy code:
S = list(input())
ansarr = []
ans = 0
for i in S:
    if ans == 0:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
    else:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
        elif i != 'A' or i != 'C' or i != 'G' or i != 'T':
            ansarr.append(ans)
            ans = 0

print(max(ansarr))


Fixed code:
S = list(input())
ansarr = []
ans = 0
ansarr.append(ans)
for i in S:
    if ans == 0:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
    else:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
        elif i != 'A' or i != 'C' or i != 'G' or i != 'T':
            ansarr.append(ans)
            ans = 0
else:
    ansarr.append(ans)


print(max(ansarr))
Buggy code:
s=input()

le=0
i=0
while(i<len(s)):
    l=0
    while(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)

Fixed code:
s=input()

le=0

i=0
while(i<len(s)):
    l=0
    while(i<len(s) and (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T')):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)
Buggy code:
import sys

b = input()

flg = 0
n = 0
nw = []
for bi in b:
    if bi == ("A" or "G" or "C" or "T"):
        flg = 1
        n += 1
    else:
        flg = 0
        n = 0
    nw.append(n)

nw.sort(reverse = True)
print(nw[0])





Fixed code:
import sys

b = input()

flg = 0
n = 0
nw = []
for bi in b:
    if bi == 'A' or bi == 'G' or bi == 'C' or bi == 'T':
        flg = 1
        n += 1
    else:
        flg = 0
        n = 0
    nw.append(n)

nw.sort(reverse = True)
print(nw[0])
Buggy code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
 
def resolve():
    S = input()
    acgt = ['A', 'C', 'G', 'T']
    ans = 0
    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
 
    print(ans)

Fixed code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0

    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            # print(l, r, S[l:r])
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
            if r==len(S):
                ans = max(len(S)-l, ans)
 
    print(ans)

if __name__ == '__main__':
    resolve()
Buggy code:
S = input()

partial = ""

conditions = ["A","T","G","C"]

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

print(max(conlist))

Fixed code:
S = input()

partial = ""

conditions = ["A","T","G","C"]

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

if len(conlist) > 0:
	print(max(conlist))
else:print(0)