peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
al = list(map(int, input().split()))

c = Counter(al)

l4 = []
l2 = []

for k, v in c.items():
    if v >= 4:
        l4.append(k)
    elif v >= 2:
        l2.append(k)

s1, s2 = 0, 0
l4 = sorted(l4, reverse=True)
l2 = sorted(l2, reverse=True)

if len(l4) > 0:
    s1 = l4[0]*2
if len(l2) >= 2:
    s2 = l2[0] * l2[1]

if s1 != 0 or s2 != 0:
    print(max(s1, s2))
else:
    print(0)
# Judge status: Wrong Answer
x = int(input());
year = 0;
money = 100;

while money < x:
    money = 1.01* money;
    year = year + 1;


print(year);
# Judge status: Accepted
sx,sy,tx,ty = map(int, input().split( ))
u = ty-sy
r = tx-sx
print("R"* r+ "U"*u + "L"*r + "D"*u + "D" 
            + "R"* (r+1)+ "U"*(u+1) + "L" + "U" + "L"*(r+1) + "D"*(u+1) +"R")
# Judge status: Accepted
import collections
n = int(input())

l = []
for i in range(n):
    l.append(int(input()))
    
a = collections.Counter(l)
cnt = 0
for k,v in a.items():
    if v%2 != 0:
        cnt += 1

print(cnt)
# Judge status: Accepted
n = int(input())
A = []
for i in range(5):
  A.append(int(input()))
ma = min(A)
if n <= ma:
  print(5)
  exit()
else:
  if n % ma == 0:
    print(5 + n//ma - 1)
  else:
    print(5 + n//ma)
# Judge status: Wrong Answer
def main():
    s = list(input())
    t = list(input())
    s = sorted(s)
    t = sorted(t)
    print(s)
    print(t)
    shrt = False
    for i in range(len(t)):
        if s[0] < t[i]:
            shrt = True
            break
    if shrt :
        print("Yes")
    else:
        print("No")
main()
# Judge status: Accepted
x = int(input())

ans = 0
for i in range(1, x+1):
    ans = (i * (i+1)) / 2
    if ans >= x:
        print(i)
        break
# Judge status: Accepted
x, y = map(int, input().split())
d = abs(abs(x) - abs(y))
if 0 <= x < y or x < y <= 0:
  print(d)
elif y <= 0 <= x or x < 0 < y:
  print(d+1)
elif 0 < y < x or y < x < 0:
  print(d+2)
else:
  raise Exception
# Judge status: Accepted
import sys

n, *lst = map(int, sys.stdin.read().split())
lst.sort()
res = lst[0]
for v in lst[1:]:
  res = (res + v) / 2
print(res)
# Judge status: Accepted
def main():
    N,K=map(int,input().split())
    ans=[i for i in range(1,N+1)]
    for _ in range(K):
        d = int(input())
        A=[int(_) for _ in input().split()]
        for a in A:
            if a in ans:
                ans.remove(a)
    print(len(ans))

main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
cnt = sum(b)
for i in range(n):
  if i<=n-2 and (a[i+1] - a[i] == 1):
    cnt += c[i]
print(cnt)
# Judge status: Accepted
N = int(input())
res = []

for i in range(N) :
    S , P = input().split()
    res.append((S , int(P) , i+1))
res_sort = sorted(res, key = lambda x:(x[0],-x[1]))

for i in range(N) :
    print(res_sort[i][2])
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))
AA=[]
point=1
for i in range(N-K+1):
    for j in range(K):
        point*=A[i+j]
        AA.append(point)
        point=1

for n in range(N-K):
    if AA[n]<AA[n+1]:
        print('Yes')
    elif AA[n]>=AA[n+1]:
        print('No')
# Judge status: Accepted
a = input()

if a in "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm":
  print ("a")
  
else :
  print("A")
# Judge status: Wrong Answer
n = input()
num = len(n)-2
for i in range(num,0,2):
  f = int(i/2)
  if s[:f]==s[f:i]:
    print(i)
    break
# Judge status: Accepted
s = input()
n = len(s)

for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            print('no')
            exit()

print('yes')
# Judge status: Accepted
S = input()
cnt1 = 0
cnt0 = 0
for s in S:
    if s == '1':
        cnt1 += 1
    else:
        cnt0 += 1
print(min(cnt1, cnt0) * 2)
# Judge status: Wrong Answer
S = input()
Q = int(input())
#inp = [input().split() for _ in range(Q)]

# 無駄なところ除く

cnt = 0
for i in range(Q):
    inp = input().split()
    if len(inp) == 1:
        cnt += 1
        #S = S[::-1]
    else:
        if cnt % 2 != 0:
            S = S[::-1]
            cnt = 0
        f, c = inp[1:]
        if int(f) == 1:
            S = c + S
        else:
            S = S + c
print(S)
# Judge status: Wrong Answer
n, m = map(int, input().split())
if m > 0:
    rem = m - 2*n
    print(n+rem//4)
else:
    print(0)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a * c <= b:
    print(a * c)
else:
    print(b // a)
# Judge status: Wrong Answer
w=input()
for i in range(len(w)):
    if w.count(w[i])%2!=0:
        print('No')
        break
    if w.count(w[i])%2==0:
        print('Yes')
        break
# Judge status: Accepted
X, Y = map(int, input().split())

count = 0
while X <= Y:
    X *= 2
    count += 1
print(count)
# Judge status: Accepted
#他の人の回答例　後から見返す用

A = input()
n = len(A)-1
for i in range(2**n):
  pn = ['-']*n
  for j in range(n):
    if ((i>>j)&1):
      pn[n-1-j] = '+'
  ans = A[0]+pn[0]+A[1]+pn[1]+A[2]+pn[2]+A[3]
  
  if eval(ans) == 7:
    print(ans+'=7')
    break
# Judge status: Wrong Answer
abc = [int(e) for e in input().split()]

H1 = abc[0]
M1 = abc[1]
H2 = abc[2]
M2 = abc[3]
K = abc[4]

start_time = H1 + M1/60
end_time = H2 + M2/60
valid_time = (end_time-start_time) * 60

if valid_time % K == 0:
    valid_time = valid_time - 1

execution_time = valid_time // K

ans = execution_time * K

print(int(ans))
# Judge status: Accepted
S=input()

if S[0]==S[1]==S[2]:
  if S[0]=='R':
    print(3)
  else:
    print(0)
elif S[0]==S[1]:
  if S[0]=='R':
    print(2)
  else:
    print(1)
elif S[1]==S[2]:
  if S[1]=='R':
    print(2)
  else:
    print(1)
else:
  print(1)
# Judge status: Wrong Answer
n = int(input())
l0 = 2
l1 = 1
sum_ = 0
for i in range(n-1):
    sum_ = l0 + l1
    l0 = l1
    l1 = sum_
print(sum_)
# Judge status: Accepted
N = int(input())
P = [int(i) for i in input().split()]
ans = 0
for i in range(N - 2):
    if P[i] < P[i + 1] < P[i + 2] or P[i] > P[i + 1] > P[i + 2]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse = True)
while M > 0:
    A[0] //= 2
    M -= 1
    for i in range(1,M):
        if i < N and A[i] >= A[0]:
            A[i] //= 2
        else:
            M -= i-1
            A.sort(reverse = True)
            break
print(sum(A))
# Judge status: Accepted
n = int(input())
ab=[]
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ans = 0
for i in range(n-1,-1,-1):
        c = (ab[i][0]+ans)%ab[i][1]
        if c!=0:
            ans += ab[i][1]-c
print(ans)
# Judge status: Accepted
n,m=map(int, input().split())
r=[0]*n
for _ in range(m):
    a,b=map(int, input().split())
    r[a-1]+=1
    r[b-1]+=1

for i in r:
    print(i)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
    if sorted([a[i-1], a[i], a[i+1]])[1]==a[i]:
        ans+=1
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
B=[0]*100001

for i in range(1,n+1):
  a,b=map(int,input().split())
  B[a]+=b
for j in range(1,10**5+1):
  k-=B[j]
  if k<=0:
    print(j)
    break
# Judge status: Accepted
x, y = map(int, input().split())
check = [1,2,1,3,1,3,1,1,3,1,3,1]
if check[x-1]==check[y-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from itertools import permutations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in permutations(L, 3):
    if set(l) != 3:
        continue
    if sum(l) - max(l) > max(l):
        ans += 1
print(ans)
# Judge status: Wrong Answer
n,a,b = map(int, input().split())
s = input()
c = 0
bi = 0
for i in range(n):
    if s[i] == "a" and c < a+b:
        print("Yes")
        c += 1
    elif s[i] == "b" and c < a+b and bi <= b:
        print("Yes")
        bi += 1
        c += 1
    else:
        print("No")
# Judge status: Accepted
n,m=input().split();print("Yes"if m==n else"No")
# Judge status: Accepted
s = input()
k = int(input())

c1 = 0
num = ""
for c in s:
    if c == "1":
        c1 += 1
    else:
        num = c
        break

if k <= c1:
    print("1")
else:
    print(num)
# Judge status: Accepted
n,k=map(int,input().split())
p=list(map(int,input().split()))
p2=sorted(p)
ans=sum(p2[0:k])
print(ans)
# Judge status: Accepted
N,M,X = map(int,input().split())
A = [list(map(int,input().split())) for n in range(N)]
a = 10**9

for i in range(2**N):
  S = (M+1)*[0]
  for j in range(N):
    if (i>>j)&1:
      S = [S[k]+A[j][k] for k in range(M+1)]
  if all([X<=s for s in S[1:]]):
    a = min(a,S[0])

if a==10**9:
  print(-1)
else:
  print(a)
# Judge status: Accepted
def main():
    x, y = map(int, input().split())
    for i in range(x+1):
        for j in range(x+1):
            if i+j == x and 2*i + 4*j == y:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
x = 1
for i in range(1,N+1):
  x = x*i
  if x >= 10**9+7:
    x = x-10**9-7
print(x%(10**+7))
# Judge status: Wrong Answer
X = int(input())
for i in range(X):
    if i*(i+1)//2 >= X:
        print(i)
        break
# Judge status: Accepted
A, B, C = [int(i) for i in input().split()]
K = int(input())

m = max(A, B, C)
print(sum([A, B, C]) - m + m * 2 ** K)
# Judge status: Wrong Answer
N, K = map(int, input().split())

A=[]
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])

A.sort(key=lambda x:x[0])

cnt = 0
for i in range(N):
    cnt += A[i][1]
    if cnt >= N:
        print(A[i][0])
        break
# Judge status: Accepted
a = map(str, input())
counter_list = []
for n in a:
    counter_list.append(n)
print(counter_list.count('1'))
# Judge status: Wrong Answer
X, Y = map(int, input().split())
ans = 1
while X <= Y:
  X *= 2
  ans += 1
print(ans)
# Judge status: Accepted
w,a,b=map(int,input().split())
if abs(a-b)>w:
  print(abs(a-b)-w)
else:
  print(0)
# Judge status: Accepted
a, b = map(int, input().split())
if (a+b) % 2 == 0:
    ans = (a+b) / 2
else:
    ans = (a+b) // 2 + 1
print(int(ans))
# Judge status: Accepted
import bisect
n = int(input())
A = [int(input()) for i in range(n)]
m = 10**9
X = []
for a in A:
    i = bisect.bisect_right(X, -a)
    if i == len(X):
        X.append(-a)
    else:
        X[i] = -a
print(len(X))
# Judge status: Accepted
N = int(input())
S = input()

r = S.count('R')
ans = r - S[:r].count('R')
print(ans)
# Judge status: Accepted
R = lambda: map(int, raw_input().split())
n, d = R()
d = d ** 2
ans = 0
for i in xrange(n):
    x, y = R()
    if x ** 2 + y ** 2 <= d:
        ans += 1
print ans
# Judge status: Wrong Answer
import sys
a = list(map(int, input().split()))
b = []
for i in sys.stdin:
  b.append(i)

b.sort()

c = ""
for j in b:
  c += j

print(c)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

result = 2020202020

for i in range(1, n-1):
    result = min(result, abs(sum(a[:i+1]) - sum(a[i+1:])))
print(result)
# Judge status: Accepted
import sys
input = sys.stdin.readline

x, k, d = map(int, input().split())
tmp = abs(x) // d

if k < tmp:
  result = abs(abs(x) - d*k)
elif tmp%2 == k%2:
  result = abs(abs(x) - d*tmp)
else:
  a = result = abs(abs(x) - d*tmp)
  result = abs(abs(a) - d)

print(result)
# Judge status: Accepted
n, a, b = map(int, input().split())
s = input()

count = 0
countB = 0
for i in range(n):
    if s[i] == 'a':
        if count < a+b:
            print('Yes')
            count += 1
        else:
            print('No')
    elif s[i] == 'b':
        if count < a+b and countB < b:
            print('Yes')
            count += 1
            countB += 1
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
n=int(input())
lst=list(map(int,input().split()))
ave=sum(lst)/n
if ave%1>=0.5:
    import math
    ave=math.ceil(ave)
else:
    ave//=1
ans=0
for i in lst:
    ans+=(abs(i-ave))**2
print(int(ans))
# Judge status: Accepted
a,b = map(int,input().split())
if a*b%2 == 0:
    print("Even")
else:
    print("Odd")
# Judge status: Wrong Answer

import sys
S = input()
N = len(S)

if (not S.islower()):
    sys.exit()
if (N < 3 or N > 99):
    sys.exit()
if (N%2 == 0):
    sys.exit()

av  = (N-1)/2
av  = int(av)
av2 = (N+3)/2
av2 = int(av2)

pal = S[0:av]
pal2 = S[av2-1:N]

if (pal == pal2[::-1]):
    if (pal == pal[::-1] and pal2 == pal2[::-1]):
        print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = lr()
# ある回数から先は全ての電球にNを足す
for _ in range(min(K, 10)):
    next = [0] * N
    for i in range(N):
        x = A[i]
        for j in range(max(0, i-x), min(N-1, i+x)+1):
            next[j] += 1
    A = next

print(*A)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().strip().split()))[:n]
flag = True
for i in range(0,n):
    if a[i]% 2 == 0:
        if a[i]% 3 != 0 and a[i]% 5 != 0:
            flag = False
if  flag==True:
    print("APPROVED")
else :
    print("DENIED")
# Judge status: Accepted
input_list = input().rstrip().split(' ')

n = int(input_list[0])
x = int(input_list[1])
t = int(input_list[2])

times = int(n / x)
if n % x != 0:
    times += 1

print(times * t)
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
a = b[0]
for i in range(1,n-1):
  a += min(b[i],b[i-1])
print(a+b[-1])
# Judge status: Accepted
import math
n=int(input())
k=(2*n+0.25)**0.5-0.5
k=math.ceil(k)
no=k*(k+1)/2-n
for i in range(1,k+1):
    if i==no:
        continue
    print(i)
# Judge status: Accepted
def resolve():
    s = input().split()
    st = s[0]+s[1]
    sqN = int(st) ** 0.5
    if sqN == int(sqN):
        print("Yes")
    else:
        print("No")
resolve()
# Judge status: Wrong Answer
n=int(input())
count=0
b=n
while b:
    b//=10
    if b:
        count+=1
if count==0:
    print(n)
elif count==1:
    print(9)
elif count==2:
    print(n-100+1+9)
elif count==3:
    print(900+9)
elif count==4:
    print(n-1000+1+909)
elif count==5:
    print(90909)
# Judge status: Accepted
cnt=0
a,s,d=map(int,input().split())
if a==s==d:
    if a%2==0:print(-1)
    else:print(0)
    exit()
while a%2==s%2==d%2==0:
    a,s,d=(s+d)//2,(a+d)//2,(a+s)//2
    cnt+=1
print(cnt)
# Judge status: Accepted
N=int(input())
ans=0
for i in range(2,10**6+1):
  anssub=0
  t=0
  while N%i==0:
    N=N//i
    anssub+=1
  while t*(t+1)//2<=anssub:
    t+=1  
  ans+=t-1
if N!=1:
  ans+=1
print(ans)
# Judge status: Accepted
K, X = map(int,input().split())
num = [X]
for i in range(1, K):
    num.append(X + i)
    num.append(X - i)
num.sort()
print(" ".join(map(str, num)))
# Judge status: Accepted
n,m = map(int,input().split())
 
lis = [[] for i in range(n)] #なぜか知らんけど[[]]*nじゃだめらしい
 
for i in range(m):
  a,b = map(int,input().split())
  lis[a-1].append(b-1)
  lis[b-1].append(a-1)
 
 
if set(lis[-1]).isdisjoint(set(lis[0])):
    print('IMPOSSIBLE')
else:
  print('POSSIBLE')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
X = 0
for i in range(N-1):
  if A[i+1] -A[i] == 1:
    X += C[A[i]-1]
print(sum(B)+X)
# Judge status: Wrong Answer
S=str(input())
if "hi" in S:
    print("Yes")
else:print("No")
# Judge status: Accepted
L=int(input())

print(L**3/27)
# Judge status: Wrong Answer
N = int(input())
X = list(map(str,input().split()))
for x in X:
  X_ = sorted(X)
  X_.remove(x)
  print(X_[(N+1)//2-1])
# Judge status: Wrong Answer
s = list(input())

if s[0] == "A" and s[2:-1].count("C") == 1 and s.count("A")==1:

    s.remove("A")
    s.remove("C")
    
    if "".join(s).lower() == "".join(s):
        print("AC")

else:
    print("WA")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

strA = str(input())

if strA == 'ABC':
  print('ARC')
elif strA == 'ARC':
  print('ABC')
else:
  print('')
# Judge status: Accepted
#c
n,k=map(int, input().split())
a = list(map(int, input().split()))
for i in range(n-k):
    if a[i] < a[i + k]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N = int(input())
n = 0

for i in range(N):
    for j in range(N):
        for k in range(N):
            n += gcd(i,j,k)
print(n)
# Judge status: Accepted
n, m = map(int, input().split())

cnt = 1

for i in range(1, int(m ** 0.5) + 1):
    if m % i == 0:
        b = m // i
        if i * n <= m:
            cnt = max(cnt, i)
        if b * n <= m:
            cnt = max(cnt, b)
print(cnt)
# Judge status: Accepted
import math

a, b, x = map(int, input().split(' '))

base = a * a * b /2

if int(base) == x:
    print(math.degrees(math.atan(b/a)))
elif base > x:
    ah = 2 * x / (a * b)
    print(math.degrees(math.atan(b/ah)))
else:
    bh = 2 * x / a ** 2 - b
    c = b - bh
    print(math.degrees(math.atan(c/a)))
# Judge status: Accepted
N = int(input())
ans = 0
for a in range(1, N):
  ans += (N - 1) // a 
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
x_li = [0]*m
y_li = [0]*m
for i in range(m):
    x_li[i],y_li[i]=map(int,input().split())

map_li = [1]*n
red = [False]*n
red[0]=True

for i in range(m):
    x,y = x_li[i],y_li[i]
    x,y = x-1,y-1
    if red[x]:
        red[y]=True
    map_li[x]-=1
    map_li[y]+=1
    if map_li[x]==0:
        red[x]=False
#print(map_li)
print(sum(red))
# Judge status: Accepted

n= int(input())
 
ans = 0
for i in range(1, n + 1):
    x = n // i
    ans += x * (x + 1) * i // 2
 
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
ans = 0
while K > 0:
    a, b = map(int, input().split())
    K -= b
    ans = a
print(a)
# Judge status: Wrong Answer
w=["Sunny","Cloudy","Rainy","Sunny"]
a=input()
l=0
for i in w:
  if a==i:
    print(w[l+1])
  else:
    l+=1
# Judge status: Accepted
N = int(input())
lst = [list(map(int, input().split())) for _ in range(2)]
res = 0
for i in range(N):
    num = sum(lst[0][0:i+1]) + sum(lst[1][i:N])
    if res < num:
        res = num 
print(res)
# Judge status: Accepted
A,B = map (int, input ().split ())
if B < 10:
  X = A*10+B
elif B < 100:
  X = A*100+B
else:
  X = A*1000+B
o = 1
p = 'No'
while o**2 <= X:
  if o**2 == X:
    p = 'Yes'
    break
  o += 1
print (p)
# Judge status: Wrong Answer
N = int(input())

divisor_cnt = 0
num = 0
# Nは奇数と言う制約があるため、約数は奇数×奇数の組み合わせ
for i in range(1, N+1, 2):
    for j in range(1, N+1, 2):
        if i * j == N:
            divisor_cnt += 1
            if divisor_cnt % 8 == 0:
                num += divisor_cnt // 8
print(num)
# Judge status: Accepted
d, t, s = map(int, input().split())
print("Yes" if t*s >= d else "No")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
k=sum(b)-sum(a)
p=0
for i in range(n):
    if a[i]>=b[i]:
        p+=a[i]-b[i]
    else:
        p+=-(b[i]-a[i])//2*-1
print('Yes' if k>=p else 'No')
print(k)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
from itertools import product

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

n, x = na()
a = na()
b = list()

if n == 2:
    print(max(sum(a) - 2*x, 0))
    quit()
else:
    for ai, aj in zip(a[:n-1], a[1:]):
        b.append(max(0, ai + aj - x))
    ans = 0
    bpre = b[0]
    for bi in b[1:]:
        ans += bpre
        bpre = max(0, bi - bpre)
    ans += bpre
    print(ans)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
index = n//2

for i in range(n):
  print(y[-index] if x[i]<x[index] else y[-index-1])
# Judge status: Wrong Answer
s,y=(input() for i in range(2))
ans="{"*len(s);pa=ans
for i in range(len(s)-len(y)):
  for j in range(len(y)):
    if s[i+j]!='?' and s[i+j]!=y[j]:break
  else:ans=min(ans,s[:i].replace("?","a")+y+s[i+len(y):].replace("?","a"))
if pa==ans:print("UNRESTORABLE")
  
else:print(ans)
# Judge status: Accepted
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]
heru = [0 for _ in range(26)]
for i in range(d):
	print(i%26 + 1)
# Judge status: Accepted
S = input()
atgc = ["A", "T", "G", "C"]
anset = set()
L = 0
for i in range(len(S)):
    if S[i] in atgc:
        L += 1
    else:
        anset.add(L)
        L = 0
    if i == len(S)-1:
        anset.add(L)

print(max(anset))
# Judge status: Accepted
a,b,_=[int(i) for i in input().split()]
print(a*b//2)
# Judge status: Accepted
s = input()
n_op = len(s) - 1
for i in range(2**n_op):
  op = ['-'] * n_op
  for j in range(n_op):
    if i>>j & 1:
      op[n_op - 1 - j] = '+'
    
  formula = ''
  for p_s, p_op in zip(s, op+['']):
    formula += p_s + p_op
  if eval(formula) == 7:
    print(formula + '=7')
    break
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
if N > M: N, M = N, M
if N == 2: print(0)
elif N == 1: print(max(0, M - 2))
else: print(max(0, (N - 2) * (M - 2)))
# Judge status: Wrong Answer
N = int(input())

if N < 1000:
  s = "ABC"
else:
  s = "ABD"
  N -= 999
  
n = ""
if N < 10:
  n = "00"
elif N < 100:
  n = "0"

print(s + n + str(N))
# Judge status: Accepted
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
MOD = 998244353
ans = 1
dep = Counter(D)
if dep[0] != 1 or D[0] != 0:
    print(0)
    exit(0)
if max(D) == 0:
    pass
else:
    for i in range(1, max(D) + 1):
        if dep[i] == 0:
            print(0)
            exit(0)
        else:
            ans *= dep[i-1] ** dep[i]
            ans %= MOD
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
ans = a[0]
for i in range(2, n):
    ans += a[i // 2]
    #print(ans)

print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1 and M > 1:
    ans = M - 2
else:
    ans = (N - 2) * (M - 2)

print(ans)
# Judge status: Accepted
import collections
S = list(input())
T = list(input())
counterS = collections.Counter(S)
counterT = collections.Counter(T)
Scou = list(counterS.values())
Tcou = list(counterT.values())
Scou.sort()
Tcou.sort()
if Scou == Tcou:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
K = int(input())

n = 1
x = 7


if (K % 2 == 0)or(K % 5 == 0):
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#
# Judge status: Wrong Answer
N = int(input())
h = list(map(int, input().split()))
dp = [float('inf') for i in range(N)]

dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
  dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp)
print(dp[N-1])
# Judge status: Wrong Answer
import math
N = int(input())
X = list(map(int, input().split()))
P = int(math.ceil(sum(X) / N))
print(sum((x - P)**2 for x in X))
# Judge status: Wrong Answer
s = input()
flg = 0
for i in range(len(s)):
    if s[i] == 'h':
        if s[i+1] =='i':
            print('Yes')
            flg = 1
            break
        else:
            continue
if flg == 0:
    print('No')
# Judge status: Accepted
a,b,c = tuple(map(int,input().split()))
if len(set((a,b,c)))==1 and a%2==1:
    print(0)
    exit()
ans = 0
while True:
  if len(set((a,b,c)))==1:
    print(-1)
    exit()
  if a%2==0 and b%2==0 and c%2==0:
    a,b,c = b//2+c//2,c//2+a//2,a//2+b//2
    ans+=1
  else:
    break
print(ans)
# Judge status: Accepted
x,a,b = map(int,input().split())
A = abs(x-a)
B = abs(x-b)

if A<=B:
  print("A")
else:
  print("B")
# Judge status: Accepted
import sys
input = sys.stdin.readline
S = list(input())[: -1]
for i in range(4):
  if S.count(S[i]) != 2:
    print("No")
    exit(0)
print("Yes")
# Judge status: Accepted
s = input().split("hi")

f = 0

for i in s:
    if i != "":
        f = 1
        break
    
if f == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
ans = 0

for i in range(n + 1):
    if a <= sum(list(map(int, list(str(i))))) >= b:
        ans += i

print(ans)
# Judge status: Accepted
a, b, c = input().split()
num = int(a+b+c)

if num % 4 == 0:
    print('YES')
else:
    print('NO')