Problem:


Score : 200 points

Problem Statement

You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.

Here, a ACGT string is a string that contains no characters other than A, C, G and T.

Notes

A substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.

For example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and  (the empty string), but not AC.

Constraints

S is a string of length between 1 and 10 (inclusive).

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest ACGT string that is a substring of S.

Sample Input 1

ATCODER

Sample Output 1

3

Among the ACGT strings that are substrings of ATCODER, the longest one is ATC.

Sample Input 2

HATAGAYA

Sample Output 2

5

Among the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.

Sample Input 3

SHINJUKU

Sample Output 3

0

Among the ACGT strings that are substrings of SHINJUKU, the longest one is  (the empty string).



Sample input:
ATCODER


Sample output:
3

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    ACGT = 'ACGT'

    ans = 0
    for i in range(len(S) - 1):
        for j in range(i + 1, len(S)):
            if j - i < ans:
                continue
            ok = True
            for c in S[i:j]:
                if c not in ACGT:
                    ok = False
                    break
            if ok and ans < j - i:
                ans = j - i

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
t = "BDEFHIJKLMNOPQRSUVWXYZ"
ans = ""
for x in s:
    if x in t:
        ans += "0"
    else:
        ans += x
print(len(max(ans.split("0"))))

Submission status: Wrong Answer

Solution code:
#n = int(input())
#n, k = map(int, input().split())
#al = list(map(int, input().split()))
#al=[list(input()) for i in range(h)]
s=list(input())
def isACGT(s):
    A=s.count('A')
    C=s.count('C')
    G=s.count('G')
    T=s.count('T')
    if A+C+G+T==len(s):
        return True
    else:
        return False

ans=0
n=len(s)
for i in range(n):
    for j in range(i+1,n):
        tempstring=s[i:j+1]
        if isACGT(tempstring):
            ans=max(ans,len(tempstring))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
L = len(S)
ACGT = ['A', 'C', 'G', 'T']
ans = 0

for i in range(L):
    for j in range(i+1, L):
        sub_S = S[i:j+1]
        if all([s in ACGT for s in sub_S]):
            if len(sub_S) > ans:
                ans = len(sub_S)

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
acgt=["A","C","G","T"]
res=0
for i in range(len(s)):
    for j in range(len(s)):
        t=s[i:j]
        tmp=False
        for j in t:
            if not j in acgt:
                tmp=True
                break
        if tmp:
            continue
        res=max(res,len(t))
print(res)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 0
    cnt = 0

    for ch in S:
        if ch == "A":
            cnt += 1
        elif ch == "C":
            cnt += 1
        elif ch == "G":
            cnt += 1
        elif ch == "T":
            cnt += 1
        elif cnt > ans:
            ans = cnt
            cnt = 0

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 0
    cnt = 0

    for ch in S:
        if ch == "A":
            cnt += 1
        elif ch == "C":
            cnt += 1
        elif ch == "G":
            cnt += 1
        elif ch == "T":
            cnt += 1
        elif cnt > ans:
            ans = cnt

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    count = 0
    for x1 in range(len(s)):
        for x2 in range(x1+1, len(s)):
            for si in s[x1:x2]:
                if si not in ["A", "T", "G", "C"]:
                    break
            else:
                if count<x2-x1:
                    count = x2-x1
    print(count)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    count = 0
    for x1 in range(len(s)):
        for x2 in range(x1+1, len(s)):
            for si in s[x1:x2]:
                if si not in ["A", "T", "G", "C"]:
                    break
            else:
                if count<x2-x1:
                    count = x2-x1
                    print(si, s[x1:x2])
    print(count)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    S = input()
    word_arr = ["A","T","G","C"]
    max_count,count = 0,0
    for c in S:
        if c in word_arr:
            count += 1
        else:
            max_count = max(count,max_count)
            count = 0
    print(max_count)

Submission status: Wrong Answer

Solution code:
s = list(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
	else:
		if count > answer:
			answer = count
		count = 0

print(answer)

Submission status: Wrong Answer

Solution code:
S=list(input())
a=0
b=[0]
for i in range(len(S)-1):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        b[len(b)-1]+=1
        if (S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T') and (S[i+1]!='A' and S[i+1]!='C' and S[i+1]!='G' and S[i+1]!='T'):
            b.append(0)
print(max(b))

Submission status: Wrong Answer

Solution code:
n = input()
l = []
v = []
for t in n:
  if t == 'A' or t == 'C' or t == 'G' or t == 'T':
    v.append(t)
  else:
    l.append(v)
    v = []
l.append(v)
print(len(max(l)))

Submission status: Wrong Answer

Solution code:
s = str(input())
mx = 0
for i in range(len(s)):
    for j in range(i+1,len(s)+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)

Submission status: Wrong Answer

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

s = input()
n = len(s)
def func(s):
    if s == "A" or s == "C" or s == "G" or s == "T":
        return True
    else:
        return False

ans = 0
for i in range(n):
    le = 0
    if func(s[i]):
        le = 1
        for j in range(i+1,n):
            if func(s[j]):
                le += 1
            else:
                ans = max(ans, le)
                break
print(ans)

Submission status: Wrong Answer

Solution code:
 
def main():
    S = input()
    candidates = ("A", "C", "G", "T")
    ans = 0
    tmp = 0
    for s in S:
        if s in candidates:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
 
    print(ans)
 
    return
 
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = str(input())
    count = 0
    count_lst = [0]
    flag = False

    for i in range(len(s)):
        letter = s[i]
        string = 'ACGT'

        if letter in string:
            count += 1
            flag = True

        else:
            if flag:
                count_lst.append(count)
            count = 0
            flag = False

    longest = max(count_lst)
    print(longest)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()
# sys.setrecursionlimit(100000)


def main():
    S = input()
    candidates = ("A", "C", "G", "T")
    ans = 0
    for i in range(len(S)):
        for j in range(i + 1, len(S)):
            for s in S[i:j]:
                if s not in candidates:
                    break
            else:
                ans = max(ans, len(S[i:j]))

    print(ans)

    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()
# sys.setrecursionlimit(100000)


def main():
    S = input()
    candidates = ("A", "C", "G", "T")
    ans = 0
    tmp = 0
    for s in S:
        if s in candidates:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0

    print(ans)

    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()

# ACGT 

num = 0
result = [0]

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

    
#print(result)
print(max(result))

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    strings = input()
    answers=[]
    counter=0

    for string in strings:
        if "A" in string or "C" in string or "G" in string or "T" in string:
            counter+=1
        else:
            answers.append(counter)
            counter=0
    print(max(answers))

Submission status: Wrong Answer

Solution code:
acgt = ['A', 'T', 'G', 'C']
word = input()
res = 0
count = 0

for s in word:
    if s in acgt:
        count += 1
    elif res < count:
        res = count
        count = 0

print(res)

Submission status: Wrong Answer

Solution code:
acgt = ['A', 'T', 'G', 'C']
word = input()
res = 0
count = 0

for s in word:
    if s in acgt:
        count += 1
    elif res < count:
        res = count

print(res)

Submission status: Wrong Answer

Solution 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(i, len(s) + 1):
        ss = s[i:j + i]
        # print(ss)
        if (checkACGT(ss)):
            ans = max(ans, len(ss))
print(ans)

Submission status: Wrong Answer

Solution 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(i, len(s)):
        ss = s[i:j + i]
        # print(ss)
        if (checkACGT(ss)):
            ans = max(ans, len(ss))
print(ans)

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

Solution code:
s=input()
temp=0
ans=0
tar="ACGT"
for ch in s:
  if ch in tar:
    temp+=1
  else:
    ans=max(ans, temp)
    temp=0

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
temp=0
ans=0
tar="ACGT"
for ch in s:
  if ch in tar:
    temp+=1
  else:
    if ans<temp:
      ans=temp
    temp=0


print(ans)

Submission status: Wrong Answer

Solution code:
s=str(input())
temp=0
ans=0
tar="ACGT"
for ch in s:
  if ch is tar:
    temp+=1
  else:
    temp=0
    if ans<temp:
      ans=temp
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
ans = [0]
x = 0

for i in range(N):
    s = S[i]
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        x += 1
    else:
        if x != 0:
            ans.append(x)
        x = 0
    
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
ans = [0]
x = 0

for i in range(N):
    s = S[i]
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        x += 1
    else:
        if x != 0:
            ans.append(x)
            x = 0
    
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = list(input())
X = ["A","C","G","T"]

max_len = 0
cur = 0

for i in S:
    if i in X: cur += 1
    else:
        max_len += cur
        cur = 0

if cur > max_len:
    max_len += cur
print(max_len)

Submission status: Wrong Answer

Solution code:
ACGT = ['A', 'C', 'G', 'T']
S = input()
cnt = 0
max_cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        max_cnt = max(cnt, max_cnt)
        cnt = 0
print(max_cnt)

Submission status: Wrong Answer

Solution code:
AGCT = ['A', 'G', 'C', 'T']
if __name__ == '__main__':
    S = input()
    max_cnt = 0
    N = len(S)
    max_cnt = 0
    for i in range(N):
        if S[i] in AGCT:
            cnt = 1 
            start = i
        else:
            continue
        for j in range(start+1, N):
            if S[j] in AGCT:
                cnt += 1
            else:
                max_cnt = max(max_cnt, cnt)
                cnt = 0
    print(max_cnt)

Submission status: Wrong Answer

Solution code:
AGCT = ['A', 'G', 'C', 'T']

if __name__ == '__main__':
    S = input()
    cnt = 0
    max_cnt = 0
    N = len(S)
    max_cnt = 0
    for i in range(N):
        if S[i] in AGCT:
            cnt = 1 
            start = i
        else:
            continue
        for j in range(start+1, N):
            if S[j] in AGCT:
                cnt += 1
            else:
                max_cnt = max(max_cnt, cnt)
                cnt = 0
    print(max_cnt)

Submission status: Wrong Answer

Solution code:
AGCT = ['A', 'G', 'C', 'T']

if __name__ == '__main__':
    S = input()
    cnt = 0
    max_cnt = 0
    N = len(S)
    max_cnt = 0
    for i in range(N):
        if S[i] in AGCT:
            cnt = 1 
            start = i
        else:
            continue
        for j in range(start+1, N):
            if i==j: continue
            if S[j] in AGCT:
                cnt += 1
            else:
                max_cnt = max(max_cnt, cnt)
                cnt = 0
    print(max_cnt)

Submission status: Wrong Answer

Solution code:
s=input()

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

Submission status: Wrong Answer

Solution code:
s=input()

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

Submission status: Wrong Answer

Solution code:
print(len(input().replace("A","").replace("G","").replace("C","").replace("T","")))

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    s_list = [x for x in input().rstrip()]

    atgc = {"A", "T", "G", "C"}
    ans = 0
    count = 0
    for s in s_list:
        # print(s)
        if s in atgc:
            count += 1
        else:
            if ans < count:
                ans = count
            count = 0

    print(ans)



if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
ok='AGCT'
s=list(input())
cnt=0
ans=0
for si in s:
  if si in ok:
    cnt+=1
  else:
    ans = max(ans,cnt)
    cnt=0
print(ans)

Submission status: Wrong Answer

Solution code:
ok='AGCT'
s=list(input())
cnt=0
ans=0
for si in s:
  if si in ok:
    cnt+=1
  else:
    ans = max(ans,cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input().strip()
L = len(S)
if len(set(list(S+"ATGC"))) == 4:
    print(L)
    exit()
l = L-1
while True:
    for i in range(L-l):
        if len(set(list(S[i:i+l]+"ATGC"))) == 4:
            print(l)
            exit()
    l -= 1

Submission status: Wrong Answer

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

s = S()
ans = 0
temp = 0
for i in s:
    if i in 'ACGT':
        temp += 1
    else:
        ans = max(ans,temp)
        temp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
l = len(s)
a=0
m=0
for i in range(l):
  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
    a+=1
  else:
    m = max(m, a)

print(m)

Submission status: Wrong Answer

Solution code:
s = list(input())
l = len(s)
a=0
m=0
for i in range(l):
  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
    a+=1
  else:
    a = max(m, a)

print(a)

Submission status: Wrong Answer

Solution code:
s = list(input())
l = len(s)
a=0
for i in range(l-1):
  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
    if s[i+1]=='A' or s[i+1]=='C' or s[i+1]=='G' or s[i+1]=='T':
      a+=1

if a==0:
  print(0)
else:
  print(a+1)

Submission status: Wrong Answer

Solution code:
S = input()

target = list('ACGT')

count_list = [0] * len(S)
for i in range(len(S)):
    if S[i] in target:
        count_list[i] = 1

max_length = 0
for start in range(len(S)):
    if count_list[start] == 0:
        continue
    for end in range(start, len(S)):
        if count_list[end] == 0:
            break
        
        print(count_list[start : end+1])
        max_length = max(sum(count_list[start : end+1]), max_length)

print(max_length)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
max_cnt = 0
cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        max_cnt = max(cnt, max_cnt)
        cnt = 0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
S = input()
AGCT = ['A', 'G', 'C', 'T']
max_cnt = 0
cnt = 0
for s in S:
    if s in AGCT:
        cnt += 1
    else:
        max_cnt = max(cnt, max_cnt)
        cnt = 0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
a=["A","G","C","T"]
f=0
m=0
ans=0
for i in range(n):
    if f==0:
        if s[i] in a:
            ans+=1
            f=1
    elif f==1:
        if s[i] in a:
            ans+=1
        else:
            m=max(ans,m)
            f=0
            ans=0
print(m)

Submission status: Wrong Answer

Solution code:
s = input()

max_length = 0
counter = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        counter += 1
    else:
        max_length = max(max_length, counter)
        counter = 0

print(max_length)

Submission status: Wrong Answer

Solution code:
S = list(input())

ans = [0]
ans_ = 0
for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        ans_ += 1
    else:
        ans.append(ans_)
        ans_ = 0
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = list(input())

ans = 0
ans_ = 0
for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        ans_ += 1
    else:
        if ans < ans_:
            ans = ans_
            ans_ = 0
print(ans)

Submission status: Wrong Answer

Solution 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
    
  else:
    ans=max(ans,cnt)
    cnt=0
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
line = "ACGT"
ans = 0

for i in range(len(S)):
    for j in range(i, len(S)):
        cnt = 0
        for n in range(i, j):
            if S[n] not in line:
                continue
            cnt += 1
        if cnt > ans:
            ans = cnt
        

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

S = input()
index = [i for i in range(len(S))]
line = list("ACGT")
ans = 0

for n in range(len(S)):
    combs = list(itertools.combinations(index, n+1))
    for comb in combs:
        mozi = ""
        cnt = 0
        for i in comb:
            if S[i] in line:
                cnt += 1
            else:
                break
        if cnt > ans:
            #print([S[i] for i in comb])
            ans = cnt
            break

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())

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

res = 0

t = 0

for s in S:
    if s in acgt:
        t += 1
    else:
        res = max(res, t)
        t = 0        

print(res)

Submission status: Wrong Answer

Solution code:
S = list(input())

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

res = 0

t = 0

for s in S:
    if s in acgt:
        t += 1
    else:
        res = max(res, t)

print(res)

Submission status: Wrong Answer

Solution code:
li = list(input())
ans = 0
num = 0
for i in range(len(li)):
    if li[i] == 'A' or li[i] == 'G' or li[i] == 'C' or li[i] == 'T':
        num += 1
    else:
        if ans < num:
            ans = num
        num = 0
if ans == 0:
    ans = num
print(ans)

Submission status: Wrong Answer

Solution code:
li = list(input())
ans = 0
num = 0
for i in range(len(li)):
    if li[i] == 'A' or li[i] == 'G' or li[i] == 'C' or li[i] == 'T':
        num += 1
    else:
        if ans < num:
            ans = num
        num = 0
print(ans)

Submission status: Wrong Answer

Solution 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)
for j in ans:
  if j == 1:
    j = 0
print(max(ans))

Submission status: Wrong Answer

Solution 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))

Submission status: Wrong Answer

Solution code:
lngs = input()

ACGT = ["A", "C", "G", "T"]
out_list = []
out_list_long = []

for lng in lngs:
    if lng in ACGT:
        out_list += lng
    else:
        if len(out_list) > len(out_list_long):
            out_list_long = []
            out_list_long = out_list
        out_list = []

print(len(out_list_long))

Submission status: Wrong Answer

Solution code:
lngs = input()

ACGT = ["A", "C", "G", "T"]
out_list = []
out_list_long = []

for lng in lngs:
    if lng in ACGT:
        out_list += lng
    else:
        if len(out_list) > len(out_list_long):
            out_list_long = out_list
        out_list = []

print(len(out_list_long))

Submission status: Wrong Answer

Solution code:
lngs = input()

ACGT = ["A", "C", "G", "T"]
out_list = []
out_list_long = []

for lng in lngs:
    if lng in ACGT:
        out_list += lng
    else:
        if len(out_list) > len(out_list_long):
            out_list_long = out_list
        out_list = []
        
    
out = ''.join(out_list_long)
print(out)

Submission status: Wrong Answer

Solution code:
lngs = input()

ACGT = ["A", "C", "G", "T"]
out_list = []

for lng in lngs:
    if lng in ACGT:
        out_list += lng
out = ''.join(out_list)
print(out)

Submission status: Wrong Answer

Solution code:
import re

print ('AC' if re.match(r'\AA[a-z]+C[a-z]+\Z', input()) else 'WA')

Submission status: Wrong Answer

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]
if N[-1] < len(S):
    M=max(1,N[0])


for j in range(len(N)-1):

    M = max( N[j+1] - N[j]-1,M)
print(M)

Submission status: Wrong Answer

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]

for j in range(len(N)-1):
    M = max( N[j+1] - N[j]-1,M)
print(M)

Submission status: Wrong Answer

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]
print(N)
for j in range(len(N)-1):
    M = max( N[j+1] - N[j]-1,M)
print(M)

Submission status: Wrong Answer

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]
for j in range(len(N)-1):
    M = max( N[j+1] - N[j],M)
print(M)

Submission status: Wrong Answer

Solution code:
S=input()
l=len(S)
ans=0
str='ACGT'
for i in range(l):
    for j in range(i,l):
        for k in range(i,j+1):
            if str.count(S[k])==1:
                ans=max(ans,j-i+1)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
for i in range(len(S)):
    for j in range(i + 1, len(S)):
        sub_s = S[i:j]
        is_acgt = True
        for s in sub_s:
            if s == "A" or s == "C" or s == "G" or s == "T":
                continue
            else:
                is_acgt = False
        if is_acgt:
            ans = max(ans, len(sub_s))

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = ['A','C','G','T']
anss = []
for i in range(len(S)):
    tmp_s = ""
    if S[i] in ACGT:
        tmp_s += S[i]
        for j in range(i+1,len(S)-i):
            if S[j] in ACGT:
                tmp_s += S[j]
            else:
                break
    anss.append([len(tmp_s),tmp_s])
anss.sort()
print(anss[-1][0])

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = ['A','C','G','T']
anss = []
for i in range(len(S)):
    tmp_s = ""
    if S[i] in ACGT:
        tmp_s += S[i]
        for j in range(i+1,len(S)-i):
            if S[j] in ACGT:
                tmp_s += S[j]
            else:
                break
    anss.append([len(tmp_s),tmp_s])
anss.sort()
print(anss[-1][1])

Submission status: Wrong Answer

Solution code:
S = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

l=0
for i in range(len(S)-1):
  for j in range(i+1,len(S)+1):
    s = set(S[i:j])
    if s <= {'A','C','G','T'} and len(S[i:j])>l:
      l = len(S[i:j])
      
print(l)

Submission status: Wrong Answer

Solution code:
S=input()

l=0
for i in range(len(S)-1):
  for j in range(i+1,len(S)):
    s = set(S[i:j])
    if s <= {'A','C','G','T'} and len(S[i:j])>l:
      l = len(S[i:j])
      
print(l)

Submission status: Wrong Answer

Solution code:
T=input()
d=["A","T","G","C"]
ans=0
pre=0
for x in T:
  if x in d:
    pre+=1
  else:
    ans=(max(ans,pre))
    pre=0
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    S = str(input())
    longest = 0
    if len(S) < 2:
        if S == 'A' or S == 'G' or S == 'C' or S == 'T':
            print(1)
            return
        else:
            print(0)
            return
    for i in range(len(S)):
        cnt = 0
        loop = 0
        t = 0
        while cnt == 0 and loop + i < len(S):
            if S[loop + i] == 'A' or S[loop + i] == 'G' or S[loop + i] == 'C' or S[loop + i] == 'T':
                t += 1
                loop += 1
            else:
                if longest < t:
                    longest = t
                cnt = 1
    print(longest)
            
main()

Submission status: Wrong Answer

Solution code:
def main():
    S = str(input())
    longest = 0
    for i in range(len(S)):
        cnt = 0
        loop = 0
        t = 0
        while cnt == 0 and loop + i < len(S):
            if S[loop + i] == 'A' or S[loop + i] == 'G' or S[loop + i] == 'C' or S[loop + i] == 'T':
                t += 1
                loop += 1
            else:
                if longest < t:
                    longest = t
                cnt = 1
    print(longest)
            
main()

Submission status: Wrong Answer

Solution code:
s = input()
c = ["A","C","G","T"]
ans = 0
count = 0
f = False
for i,ss in enumerate(s):
    if i == 0 and s[i] in c:
        count = 1
        f = True
        continue
    if f:
        if s[i] in c:
            count += 1
        else:
            ans = max(count,ans)
            count = 0
            f = False
    else:
        if s[i] in c:
            count += 1
            f = True
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
x = 0
y = 0
for i in range(len(s)):
  if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
    x = x + 1
  else:
    if y < x:
      y = x
    x = 0
print(y)

Submission status: Wrong Answer

Solution code:
words = input()

lst = ['A', 'C', 'G', 'T']
max_count = 0
count = 0
for i in range(len(words)):
  if words[i] in lst:
    count += 1
  else:
    if count > max_count:
      max_count = count
    count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
lst = ['A', 'C', 'G', 'T']
word = input()

lst2 = []
lst3 = []
lst4 = []
lst5 = []
lst6 = []
lst7 = []
lst8 = []
lst9 = []
lst10 = []
for s1 in lst:
  for s2 in lst:
    lst2.append(s1+s2)
    for s3 in lst:
      lst3.append(s1+s2+s3)
      for s4 in lst:
        lst4.append(s1+s2+s3+s4)
        for s5 in lst:
          lst5.append(s1+s2+s3+s4+s5)
          for s6 in lst:
            lst6.append(s1+s2+s3+s4+s5+s6)
            for s7 in lst:
              lst7.append(s1+s2+s3+s4+s5+s6+s7)
              for s8 in lst:
                lst8.append(s1+s2+s3+s4+s5+s6+s7+s8)
                for s9 in lst:
                  lst9.append(s1+s2+s3+s4+s5+s6+s7+s8+s9)
                  for s10 in lst:
                    lst10.append(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10)
if word in lst10:
  print(10)
elif word in lst9:
  print(9)
elif word in lst8:
  print(8)
elif word in lst7:
  print(7)
elif word in lst6:
  print(6)
elif word in lst5:
  print(5)
elif word in lst4:
  print(4)
elif word in lst3:
  print(3)
elif word in lst2:
  print(2)
elif word in lst:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import re
print(len(max(re.split(r'[^ACGT]',input()))))

Submission status: Wrong Answer

Solution code:
s = input()

max_value = 0
count = 0
for c in s:
  if c in "ACGT":
    count += 1
  else:
    max_value = max(max_value, count)
    count = 0
print(max_value)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        ok = True
        for k in range(i, j+1):
            if not (S[k] == "A" or S[k] == "C" or S[k] == "G" or S[k] == "T"):
                ok = False
                break
        if ok:
            ans = max(ans, j - i + 1)

print(ans)