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:
S = input()

result = 0
for i in range(len(S)):
    for j in range(len(S)):
        for ti in S[i:j]:
            if ti not in ['A', 'C', 'G', 'T']:
                break
        else:
            result = max(result, len(S[i:j]))
print(result)

Submission status: Wrong Answer

Solution code:
a = list(input())
ans = 0
count = 0
for i in a:
     if i in ['A','T','C','G']:
          count += 1
     else:
          ans = max(count,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ml = 0
nc = 0
for c in s:
    if c in "ACGT": 
        nc += 1
    else:
        ml = max(ml, nc)
        nc = 0

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)

ans = 0
before = 0
for i in range(N):
    tmp = S[i]
    if tmp == 'A' or tmp == 'T' or tmp=='C' or tmp == 'G':
        pass
    else:
        ans = max(i - before, ans)
        before = i + 1

ans = max(i - before, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
ss = input()
ans = 0
cnt = 0
for s in ss:
    if s == "A" or s == "T" or s == "C" or s == "G":
        cnt += 1
    else:
        if ans < cnt:
            ans = cnt
        cnt = 0
            
print(ans)

Submission status: Wrong Answer

Solution code:
n = list(input())

qtd = 0
ma = 0
let = ['A','C','G','T']

for i in range(len(n)):
    if(n[i] in let):
        qtd+=1
    else:
        ma = max(ma,qtd)
print(ma)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    tot = 0
    count = 0
    for c in S:
        if c in "ACGT":
            count += 1
        else:
            tot = max(tot, count)
            count = 0
    print(tot)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans,count,flag = 0,0,1
for s in S:
    if s in L:
        if not flag:
            flag = 1
            count = 0
        count += 1
    else:
        if flag:
            flag = 0
            ans = max(ans,count)

print(ans)

Submission status: Wrong Answer

Solution code:
A = input()
a = [str(c) for c in A]
ans = 0
c = 0
for i in a:
	if i == "A" or i =="C" or i == "G" or i =="T":
		c = c + 1
	else:
		if c > ans:
			ans = c
		c = 0
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    count_max = 0
    count = 0
    s = input()
    for c in s:
        if c in "ATGC":
            count += 1
        else:
            count_max = max(count, count_max)
            count = 0

    print(count_max)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()

targets = list("AGCT")
out = 0
count = 0
for s in S:
    if s in targets:
        count += 1
    else:
        out = max(out, count)
        count = 0

print(out)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# B
s = str(input())
max_len = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        a = s[i:j]
        a_l = list(a)
        ACGT = True
        for c in a_l:
            if c == 'A' or c == 'C' or c == 'G' or c == 'T':
                continue
            else:
                ACGT = False
                break
        if ACGT:
            if max_len < len(a):
                max_len = len(a)
print(max_len)

Submission status: Wrong Answer

Solution code:
S = str(input())
T1 = ""
T2 = ""
target = ["A","C","G","T"]

for i in range(len(S)):
    if S[i] in target:
        T1+=S[i]
    else:
        break
for i in range(len(S)):
    if S[len(S)-i-1] in target:
        T2+=S[i]
    else:
        break

print(max(len(T1),len(T2)))

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
mans=0
for i in s:
  if(i=="A" or i=="C" or i=="G" or i=="T"):
    ans+=1
  else:
    mans=max(ans,mans)
    ans=0
print(mans)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 0
    c = 0
    for s in S:
        if s not in ['A', 'T', 'G', 'C']:
            ans = max(ans, c)
            c = 0
            continue
        c += 1
    print(ans)


main()

Submission status: Wrong Answer

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

print(ma)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

"""
S = input()

tmp = 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
    else:
        if tmp < cnt:
            tmp = cnt
        else:
            pass
        cnt = 0
res = tmp
print(tmp)

Submission status: Wrong Answer

Solution code:
S=input()
B=[]
ACGT=['A','C','G','T']
for s in S:
    if s in ACGT: B.append(True)
    else: B.append(False)
ans=0
for start in range(len(S)-1):
    if not B[start]: continue
    count=1
    for end in range(start+1,len(S)):
        if not B[end]:
            ans=max(ans,count)
            break
        count+=1
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)

ans = 0
before = 0
for i in range(N):
    tmp = S[i]
    if tmp == 'A' or tmp == 'T' or tmp=='C' or tmp == 'G':
        pass
    else:
        ans = max(i - before, ans)
        before = i + 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
co = 0
max = 0
for i in range(len(n)) :
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C" :
        co += 1
    else :
        if co >= max :
            max = co
print(max)

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
S = list(str(input()))
agct = {'A', 'C', 'G', 'T'}

ans = ''
tmp_ans = ''
flg = 0
for s in S:
    if s in agct:
        if flg == 0:
            flg = 1
            tmp_ans += s
        else:
            tmp_ans += s
    else:
        if flg == 1:
            flg = 0
            if len(ans) < len(tmp_ans):
                ans = tmp_ans
            tmp_ans = ''
print(len(ans))

Submission status: Wrong Answer

Solution code:
n=input()
l=["A","T","C","G"]
res=0
cnt=0

for i in range(len(n)):
  if n[i] in l:
    cnt+=1
  else:
    if cnt>res:
      res=cnt
      cnt=0
      
print(res)

Submission status: Wrong Answer

Solution code:
s = input()
res = 0
for i in range(len(s)-1):
    for j in range(i + 1, len(s)):
        tmp = s[i:j]
        flag = True
        for k in range(len(tmp)):
            if not (tmp[k] == 'A' or tmp[k] == 'G' or tmp[k] == 'C' or tmp[k] == 'T'):
                flag = False
                break
        if flag:
            res = max(res, len(tmp))
print(res)

Submission status: Wrong Answer

Solution code:
S = input()

items = ['A', 'G', 'C', 'T']
ans = 0
length = 0
for i in range(len(S)):
    if S[i] in items:
        length += 1
    else:
        ans = max(ans, length)
        length = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()

r=0
b=0
for z in s:
  if z=="A" or z=="C" or z=="G" or z=="T":
    b+=1
  else:
    if r<b:
      r=b
    b=0

print(r)

Submission status: Wrong Answer

Solution code:
b = input()
l = ["A","T","G","C"]
counting = 0
tmp=0
for bb in b:
    if bb in l:
        tmp+=1
    else:
        if counting<tmp:
            counting=tmp
        tmp=0
print(counting)

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = 'ACGT'
ans = 0
for i in range(len(S)):
    l = 0
    for j in range(i, len(S)):
        if S[j] in ACGT:
            l += 1
        else:
            ans = max(ans, l)
            break
print(max(ans, l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
ls=["A",'C','G','T']
ans=0
u=0
for i in s:
  if i in ls:
    cnt=0
    while u<len(s) and s[u] in ls:
      cnt+=1
      u+=1
    ans=max(cnt,ans)
  u+=1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    tot = 0
    count = 0
    for c in S:
        if c in "ACGT":
            count += 1
        else:
            tot = max(tot, count)
            counter = 0
    print(tot)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = input()
a = {"A", "T", "G", "C"}
now = 0
M = 0
for c in x:
    if c in a:
        now += 1
    else:
        if now > M:
            M = now
        now = 0
print(M)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
arr = ['A', 'C', 'G', 'T']

cnt = 0
maxCnt = 0
for s in S:
  if s in arr:
    cnt += 1
  else:
    if maxCnt < cnt:
      maxCnt = cnt
      cnt = 0
print(maxCnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

S = input()

S = S.replace("A", "-")
S = S.replace("C", "-")
S = S.replace("G", "-")
S = S.replace("T", "-")

for i in range(11):
    if not "".join(["-"] * i) in S:
        print(i - 1)
        exit()

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
C = [0]
for i in list(S):
  if i == "A" or i == "C" or i == "G" or i == "T":
    count += 1
  else:
    C.append(count)
    count = 0

print(max(C))

Submission status: Wrong Answer

Solution code:
S = input()
tmp = 0
ans = 0
for s in S:
  if s == "A" or s == "C" or s == "G" or s == "T":
    tmp += 1
  else:
    if tmp > ans:
      ans = tmp
    tmp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
l=list(s)
m=0
for i in l:
    if i=="A" or i=="T" or i=="C" or i=="G":
        m+=1
    else:
        pass
print(m)

Submission status: Wrong Answer

Solution code:
S = str(input())
n = len(S)
L = ["A","C","G","T"]
w = [0]
for i in range(n):
    if S[i] in L:
        for j in range(i,n):
            if S[j] in L:
                continue
            else:
                w.append(len(S[i:j]))
                break
print(max(w))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

S = input()

m = 0
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if all(x in 'ATCG' for x in S[i:j]):
            m = max(len(S[i:j]), m)
print(m)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
temp = 0

# import pdb;pdb.set_trace()
for s in S:
    if s=='A' or s=='C' or s=='G' or s=='T':
        temp += 1
    else:
        if ans<temp:
            ans = temp
        temp = 0
        
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def main():
  s = input()
  maxi = 0
  _maxi = 0
  for x in s:
    if x in ['A', 'T', 'G', 'C']:
      _maxi += 1
    else:
      if maxi < _maxi:
        maxi = _maxi
      _maxi = 0
  print(maxi)


if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0;ls = ['A','T','G','C'];o = 0
for i in range(len(s)):
    check = False
    for j in range(4):
        if ls[j] == s[i]:check = True
    if check:ans += 1
    else:
        o = max(ans,o)
        ans = 0
print(o)

Submission status: Wrong Answer

Solution code:
s = input()
check = ["A", "C", "G", "T"]

output = 0
count = 0
for i in range(len(s)):
	if s[i] in check:
		count += 1
	else:
		output = max(output, count)
		count = 0

print(output)

Submission status: Wrong Answer

Solution code:
s = input()

len = 0
max_len = 0

for ch in s:
    if ch in "ATCG":
        len += 1
    else:
        max_len = max(max_len, len)
        len = 0

print(max_len)

Submission status: Wrong Answer

Solution code:
s = input()

cnt = 0
max_cnt = 0
for elem in s:
    if elem == 'A' or elem == 'C' or elem == 'G' or elem == 'T':
        cnt += 1
    else:
        if max_cnt < cnt:
            max_cnt = cnt
        cnt = 0
print(max_cnt)

Submission status: Wrong Answer

Solution code:
b = input()
_l = ["A", "T", "C", "G"]
max_l = 0
cur_l = 0
for i, s in enumerate(b):
    if s in _l:
        cur_l += 1
    if s not in _l:
        max_l = max(max_l, cur_l)
        cur_l = 0
print(max_l)

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    n = input()
    if n == "A":
        print("T")
    elif n == "C":
        print("G")
    elif n == "G":
        print("C")
    else:
        print("A")
    return

#B
def B():
    s = S()
    ans = 0
    n = len(s)
    for i in range(n):
        for j in range(i+1,n):
            f = 1
            for k in range(i,j+1):
                if s[k] not in list("AGCT"):f = 0
            if f:
                ans = max(ans,j+1-i)
    print(ans)
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
cnt = 0
for i in S:
    if i in "ACGT":
        cnt += 1
    else:
        if ans < cnt:
            ans = cnt
        cnt = 0

print(ans)

Submission status: Wrong Answer

Solution code:


S=input()


c=0
m=0
for i in range(len(S)):
	if(S[i]=="A" or S[i]=="T" or S[i]=="G" or S[i]=="C"):
		c+=1
	else:
		if(m<=c):
			m=c
		c=0

print(m)

Submission status: Wrong Answer

Solution code:
s = input()
atcg = ['A','T','C','G']
streak = 0
mcnt = 0
for i in s: 
    if i in atcg: streak += 1
    else: 
        if streak > mcnt: mcnt = streak
        streak = 0
print(mcnt)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
tmp = 0
for s in S:
  if s in "ACGT":
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
a = 0
b = 0
for i in range(len(s)):
  if s[i] in "ATCG":
    b += 1
  else:
    if b > 0:
      a = max(a,b)
      b = 0

print(a)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

S = input()

S = S.replace("A", "-")
S = S.replace("C", "-")
S = S.replace("G", "-")
S = S.replace("T", "-")

for i in range(10):
    if not "".join(["-"] * i) in S:
        print(i - 1)
        exit()

Submission status: Wrong Answer

Solution code:
txt=input()
big=-1
temp=0
ans=''
for t in txt:
	if(t=='A'):
		ans+='1'
	elif(t=='G'):
		ans+='1'
	elif(t=='C'):
		ans+='1'
	elif(t=='T'):
		ans+='1'
	else:
		ans+='0'

for t in ans:
	if(t=='1'):
		temp+=1
	else:
		if(big<temp):
			big=temp
		temp=0

print(big)

Submission status: Wrong Answer

Solution code:
a=t=0
for s in input():
    if s=='A'or s=='C'or s=='G'or s=='T':
        t+=1
    else:
        a=max(a,t)
        t=0
print(a)

Submission status: Wrong Answer

Solution code:
s = input()
letters = ["A","G","C","T"]
counter = 0
record = 0

for letter in s:
    if letter in letters:
        counter += 1
    else:
        record = max(record,counter)
        counter = 0
        
print(record)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
l = 0
for i in s:
    if(i == "A" or i == "T" or i == "G" or i == "C"):
        l += 1
    else:
        ans = max(ans, l)
        l = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
count = 0
for i in S:
    #print(i)
    if i == "A" or i == "T" or i == "G" or i == "C":
        count+=1
    else:
        ans = max(ans,count)
        count = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

temp = 0
count = 0
for i in range(len(S)):
    if 'A' == S[i]:
        temp += 1
    elif 'T' == S[i]:
        temp += 1
    elif 'C' == S[i]:
        temp += 1
    elif 'G' == S[i]:
        temp += 1
    else:
        count = max(count, temp)
        temp = 0

print(count)

Submission status: Wrong Answer

Solution code:
S = input()

maxcnt = 0
cnt = 0
for b in S:
  if b == "A" or \
     b == "C" or \
     b == "G" or \
     b == "T":
    cnt += 1
  else:
    if cnt > maxcnt:
      maxcnt = cnt
    cnt = 0
print(maxcnt)

Submission status: Wrong Answer

Solution code:
S = input()
contain = ["A", "C", "G", "T"]
index = 0
size = 0
maxlen = 0
while index < len(S):
    if S[index] in contain:
        size += 1
    else:
        if size > maxlen:
            maxlen = size
        size = 0
    index += 1
print(str(maxlen))

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
tmp = 0
for c in s:
    print(c)
    if c in "ACGT":
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
ans = max(ans, tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
current = 0
ret = 0
for x in S:
    if x in 'ACGT':
        current += 1
    else:
        ret = max(ret, current)
        current = 0
print(ret)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    tot = 0
    count = 0
    for c in S:
        if c in "ACGT":
            count += 1
        else:
            tot = max(tot, count)
    print(tot)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import io, sys, atexit, os

import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations


def li ():
	return list (map (int, input ().split ()))


def num ():
	return map (int, input ().split ())


def nu ():
	return int (input ())


def find_gcd ( x, y ):
	while (y):
		x, y = y, x % y
	return x


mm = 1000000007



def solve ():
	t = 1
	for it in range (t):
		s=input()
		if("ACGT" in s):
			print(4)
			continue
		if("ACG" in s):
			print(3)
			continue
		if("AC" in s):
			print(2)
			continue
		if("A" in s):
			print(1)
			continue
		print(0)
			





if __name__ == "__main__":
	solve ()

Submission status: Wrong Answer

Solution code:
S = input()

result = 0
count = 0
for si in S:
    if si in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        result = max(count, result)
        count = 0

print(result)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
record=0
swit=0
atgc=['A', 'T', 'G', 'C']
for i in range(len(n)):
    if n[i] in atgc:
        swit+=1
    else:
        if swit>record:
            record=swit
        swit=0
print(record)

Submission status: Wrong Answer

Solution code:
s = input()

cnt = 0
max_cnt = 0
for elem in s:
    if elem == 'A' or elem == 'C' or elem == 'G' or elem == 'T':
        cnt += 1
    else:
        if max_cnt < cnt:
            max_cnt = cnt
            cnt = 0
print(max_cnt)

Submission status: Wrong Answer

Solution code:
s=input()
N = len(s)
score = 0
record = 0
for i in range(N):
    if s[i] in "AGCT":
        score += 1
    else:
        if record <= score:
            record = score
        score = 0

print(record)

Submission status: Wrong Answer

Solution code:
S = list(input())
m = 0
count = 0
for s in S:
    if s in ['A', 'G', 'T', 'C']:
        count += 1
    else:
        if m <= count:
            m = count
        count = 0
print(m)

Submission status: Wrong Answer

Solution code:
S=input()

count=0
res=0
li=["A","T","G","C"]
for i in S:
    if(i in li):
        count+=1
    else:
        res=max(res,count)
        count=0
print(res)

Submission status: Wrong Answer

Solution code:
s = list(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
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
tmp = 0
for c in s:
  if c not in['A','C','G','T']:
    ans = max(ans, tmp)
    tmp = 0
  else:
    tmp += 1
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
t = list("ATCG")
maxv = 0
tmp = 0
for i in range(len(S)):
    if S[i] in t:
        tmp += 1
    else:
        maxv = max(maxv, tmp)
        tmp = 0
print(maxv)

Submission status: Wrong Answer

Solution code:
S = str(input())

count = 0
count_max = 0
for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i =='G':
        count += 1
    else:
        count_max = max(count, count_max)
        count = 0

print(count_max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

result = 0
count = 0
for si in S:
    if si in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        result = max(count, result)

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

result = [0]
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        result.append(count)
        count = 0

print(max(result))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

S=input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
List = set(["A", "T", "G", "C"])
cnt = 0
ResMax = 0

for i in S:
    if i in List:
        cnt += 1
    else:
        if cnt > ResMax:
            ResMax = cnt
        cnt = 0

print(ResMax)

Submission status: Wrong Answer

Solution code:
""" AtCoder """

S = input()

ans = 0
ans_max = 0
l = ['A', 'C', 'G', 'T']

for i in S:
    if i in l:
        ans += 1
    else:
        ans_max = max(ans_max, ans)
        ans = 0

print(ans_max)

Submission status: Wrong Answer

Solution code:
S = input()
lis = "ATGC"
print(len([s for s in S if s in lis]))

Submission status: Wrong Answer

Solution code:
S=input()

L=len(S)
ANS=0
SET={"A","C","G","T"}
for i in range(L):
    for j in range(i,L):
        X=S[i:j]
        for x in X:
            if x in SET:
                continue
            else:
                break

        else:
            ANS=max(ANS,len(X))

print(ANS)

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    b = S()
    b = b[0]
    if b == "A":
        print("T")
    elif b == "T":
        print("A")
    elif b == "C":
        print("G")
    elif b == "G":
        print("C")
    return

#B
def B():
    s = S()
    print(s.count("A")+s.count("G")+s.count("C")+s.count("T"))
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for l in range(len(s)):
    for r in range(l, len(s)):
        t = s[l:r]
        if all(c in 'ACGT' for c in t):
            ans = max(ans, len(t))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

t = 0
ma = 0
for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T":
    t += 1
  else:
    ma = max(ma, t)
    t = 0

print(ma)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    ans = 0
    tmp = 0
    for s in S:
        if s in 'ACGT':
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0

    return ans

print(main())

Submission status: Wrong Answer

Solution code:
s=input()
cnt=0
ans=0
atcg=['A','T','C','G']
for i in range(len(s)):
    if s[i] in atcg:
        cnt+=1
    elif s[i] not in atcg:
        ans=max(cnt,ans)
        cnt=0
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

s = {'A','T','G','C'}

ans = 0
for i,q in enumerate(S):
    cur  =0
    ind = i
    while ind < len(S) - 1 and S[ind] in s:
        cur += 1
        ind += 1
    ans = max(ans, cur)
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

L=len(S)
ANS=0
SET={"A","C","G","T"}
for i in range(L-1):
    for j in range(i+1,L):
        X=S[i:j]
        for x in X:
            if x in SET:
                continue
            else:
                break

        else:
            ANS=max(ANS,len(X))

print(ANS)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
tmp = 0
for c in s:
    if c in "ACGT":
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
ans = [0]

for s in S:
    if s in 'ACGT':
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))