Harryxun/stf_run huggingface dataset:
S = input()

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

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

### FIXED CODE ###

S = input()

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

i = 0
while i < len(S):
    #print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                #print('k=', k)
                #print('i+k=',i+k)
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
N = int(input())
A = []; B = []; C = []
for i in range(N):
    a, b, c = map(int, input().split())
    A.append(a); B.append(b); C.append(c)

dp = [[0,0,0]]*(N+1)
for i in range(N):
    dp[i+1][0] = max(dp[i][1] + A[i], dp[i][2] + A[i])
    dp[i+1][1] = max(dp[i][0] + B[i], dp[i][2] + B[i])
    dp[i+1][2] = max(dp[i][0] + C[i], dp[i][1] + C[i])
    
print(max(dp[N]))


### FIXED CODE ###

N = int(input())
h = list(map(int,input().split()))
dp = [0] * N
for i in range(1, N):
    if i == 1:
        dp[i] = abs(h[1] - h[0])
    else:
        dp[i] = min(abs(h[i] - h[i-1])+dp[i-1], abs(h[i] - h[i-2])+dp[i-2])
print(dp[N-1])
S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,100010):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)


### FIXED CODE ###

S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,100010):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
if M==0:
    ans=1
    print(S[N+1])
    exit()
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)
import numpy as np

n = input()
li = list(map(float, input().split()))
result = np.prod(li)

if float(result) >= 1000000000000000001:
    print(-1)
else:
    print(int(result))

### FIXED CODE ###

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

if 0 in li:
    print(0)
    exit(0)

ans = 1
for i in li:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit(0)

print(ans)
s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    #print(i)
    tnew.append(t[i])
cnt=0

for i in range(len(s)):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    #print(i)
    tnew.append(t[i])
cnt=0

if len(s)<=len(t):
    L=len(s)
else:
    L=len(t)


for i in range(L):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        print('Yes')
    else:
        print('No')
def solve(N, Q, ABs, PXs):
    values = {i: 0 for i in range(Q + 1)}
    ans = [-1 for i in range(N + 1)]
    vertexes = {}
    for a, b in ABs:
        vertexes.setdefault(a, []).append(b)
        vertexes.setdefault(b, []).append(a)

    for p, x in PXs:
        values[p] += x

    queue = []
    queue.append((1, 0))
    while queue:
        index, parent_value = queue.pop()
        value = parent_value + values[index]
        ans[index] = value
        for child in vertexes[index]:
            if ans[child] == -1:
                queue.append((child, value))
    return " ".join([str(a) for a in ans[1:]])


if __name__ == "__main__":
    N, Q = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    PXs = [tuple(map(int, input().split(" "))) for _ in range(Q)]
    print(solve(N, Q, ABs, PXs))


### FIXED CODE ###


def solve(N, Q, ABs, PXs):
    values = {i: 0 for i in range(N + 1)}
    ans = [-1 for i in range(N + 1)]
    vertexes = {}
    for a, b in ABs:
        vertexes.setdefault(a, []).append(b)
        vertexes.setdefault(b, []).append(a)

    for p, x in PXs:
        values[p] += x

    queue = []
    queue.append((1, 0))
    while queue:
        index, parent_value = queue.pop()
        value = parent_value + values[index]
        ans[index] = value
        for child in vertexes[index]:
            if ans[child] == -1:
                queue.append((child, value))
    return " ".join([str(a) for a in ans[1:]])


if __name__ == "__main__":
    N, Q = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    PXs = [tuple(map(int, input().split(" "))) for _ in range(Q)]
    print(solve(N, Q, ABs, PXs))
# import sys
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split())) + [10**13]
B = [0] + list(map(int, input().split())) + [10**13]
sum_t = 0
cumsumA = [0]
cumsumB = [0]
ansA = N
ansB = M
tmp = 0
for i in range(1, N+1):
    tmp = tmp + A[i]
    if tmp > K:
        ansA = i-1
        break
    cumsumA += [tmp]
tmp = 0
for i in range(1, M+1):
    tmp = tmp + B[i]
    if tmp > K:
        ansB = i-1
        break
    cumsumB += [tmp]

ans_t = cumsumA[ansA] + cumsumB[ansB]
ansAA = ansA
ansBB = ansB
ans = ansA + ansB
ans2 = max([ans, ansAA, ansBB])
visited_dict = {}
while K < ans_t:    
    ai, bi = A[ansA], B[ansB]
    if visited_dict.get((ai, bi)):
        break
    visited_dict[(ai, bi)] = 1
    if ai >= bi:
        ans_t -= ai
        ans -= 1
        ansA -= 1
        bi = B[ansB+1]
        while ans_t <= K:
            ans += 1
            ans_t += bi
            ansB += 1
            bi = B[ansB+1]
    else:
        ans_t -= bi
        ans -= 1
        ansB -= 1
        ai = A[ansA+1]
        while ans_t <= K:
            ans += 1
            ans_t += ai
            ansA += 1
            ai = A[ansA+1]
    
ans2 = max(ans-1, ans2)

print(ans2)
# print(ansA, ansB)

### FIXED CODE ###

# import sys
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split())) + [10**13]
B = [0] + list(map(int, input().split())) + [10**13]
sum_t = 0
cumsumA = [0]
cumsumB = [0]
ansA = N
ansB = 0
tmp = 0
for i in range(1, N+1):
    tmp = tmp + A[i]
    if tmp > K:
        ansA = i-1
        break
    cumsumA += [tmp]
tmp = 0
for i in range(1, M+1):
    tmp = tmp + B[i]
    if tmp > K:
        break
    cumsumB += [tmp]
j = 0
ans = 0
for i in range(ansA, -1, -1):
    t = cumsumA[i] + cumsumB[j]
    while True:
        tmp = B[j+1]
        if tmp + t <= K:
            t += tmp
            j += 1
        else:
            break
    ans = max(ans, i + j)
print(ans)
a, b = map(int,input().split())
if a >= b:
  a = str(a)a
  print(a*b)
else:
  b = str(b)
  print(b*a)

### FIXED CODE ###

a, b = map(int,input().split())
if b >= a:
  a = str(a)
  print(a*b)
else:
  b = str(b)
  print(b*a)
c=0
n=int(input())
s=input().split()
q=int(input())
t=input().split()
for i in t:
	for j in s.sort():
		if int(i)==int(j):
			c +=1
			break
print(c)


### FIXED CODE ###

c=0
n=int(input())
s=input().split()
q=int(input())
t=input().split()
s.sort()

print(len(set(s)&set(t)))
n = list(map(int, input().split())) 
i = list(map(int, input().split())) 
i.sort()
while(n[0] >= n[1]):
  print(0)
  break
k=1
kyori=list()
while k < n[1]: 
  sa=i[k]-i[k-1]
  kyori.append(sa)
  k=k+1
mm=1
idou=sum(kyori)
for mm in range(0, n[0]-1,1):
  saidai=max(kyori)
  idou=idou-saidai
  kyori.remove(saidai)
print(idou)

### FIXED CODE ###

n = list(map(int, input().split())) 
i = list(map(int, input().split())) 
i.sort()
if(n[0] >= n[1]):
  print(0)
else:
	k=1
	kyori=list()
	while k < n[1]: 
	  sa=i[k]-i[k-1]
	  kyori.append(sa)
	  k=k+1
	kyori.sort()
	mm=1
	owari=n[1]-n[0]
	kyori=kyori[0:owari]
	idou=sum(kyori)
	print(idou)
a, b = map(int,(input().split(",")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b = map(int,(input().split(" ")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(1 << N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            h = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in h[1:]) == True:
        if ans == -1:
            ans = h[0]
        else:
            ans = min(ans,total[0]) 
print(ans)



### FIXED CODE ###

# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(1 << N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in total[1:]) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)
n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a,b = [0],[0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans,j = 0,m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = (ans, i + j)
print(ans)


### FIXED CODE ###

n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a,b = [0],[0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans,j = 0,m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
n = input()
if n.count() == 0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

n = input()
if n.count('7') == 0:
    print('No')
else:
    print('Yes')
l=list(input().split())
A=int(l[0])
B=int(l[1])
c=0
for i in range(1,1009):
	if int(i*0.08)==A and int(i**0.1)==B:
  		print(i)
        c=1
        break
if c==1:
	print(-1)

### FIXED CODE ###

l=list(input().split())
A=int(l[0])
B=int(l[1])
c=0
for i in range(1,100001):
  if int(i*0.08)==A and int(i*0.1)==B:
    print(i)
    c=1
    break
if c==0:
	print(-1)
S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print h + ':' + m + ':' + s

### FIXED CODE ###

S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print str(h) + ':' + str(m) + ':' + str(s)
import sys
input = sys.stdin.readline

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

Ama = max(A)

dp=[float("inf")]*(h+Ama)
dp[0]=0

for i in range(n):
    for j in range(A[i],h+Ama+1):
        dp[j]=min(dp[j],dp[j-A[i]+B[i]])
print(min(dp[h:]))

### FIXED CODE ###

h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
 
dp = [float("inf")] * (2 * 10000 + 1)
dp[0] = 0
for i in range(h):
    for j in range(n):
        if (i + a[j]) > 2 * 10000:
            dp[2 * 10000] = min(dp[2 * 10000], dp[i] + b[j])
            continue
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])
 
ans = float('inf')
for j in range(h, 2 * 10000 + 1):
    ans = min(ans, dp[j])
print(ans)
from math import sqrt
x1,x2,y1,y2=map(int, print().split())
a=abs(x1-y1)
b=abs(x2-y2)
s=sqrt(a+b)
print(s)


### FIXED CODE ###

from math import sqrt
x1,x2,y1,y2=map(float,input().split())
a=abs(x1-y1)**2
b=abs(x2-y2)**2
s=sqrt(a+b)
print(s)
from heapq import heappop, heappush
import numpy as np



def dijkstra(graph, n, vst=0):
    distance = [float('inf')] * n
    distance[vst] = 0
    checked_v = [0] * n
    route = [''] * 10
    route[vst] = str(vst)
    dist = [float('inf')] * n
    dist[vst] = 0
    q = []
    heappush(q, (0, vst))
    for _ in range(n):
        while True:
            min_dist, search_v = heappop(q)
            if checked_v[search_v] == 0:
                break
        checked_v[search_v] = 1
        for to_v in range(n):
            if checked_v[to_v] == 0:
                cost = graph[search_v][to_v]
                if dist[search_v] + cost < dist[to_v]:
                    dist[to_v] = dist[search_v] + cost
                    route[to_v] = route[search_v] + str(to_v)
                    heappush(q, (dist[to_v], to_v))
    return dist


h, w = map(int, input().split())
graph = np.array([np.array(list(map(int, input().split()))) for _ in range(10)])
graph = np.transpose(graph)
dist = dijkstra(graph, 10, vst=1)


wall_num = []
for i in range(h):
    wall_num += list(map(int, input().split()))



ret = 0
for num in wall_num:
    if num != -1:
        ret += dist[num]


print(ret)

### FIXED CODE ###

from heapq import heappop, heappush
import numpy as np



def dijkstra(graph, n, vst=0):
    distance = [float('inf')] * n
    distance[vst] = 0
    checked_v = [0] * n
    route = [''] * 10
    route[vst] = str(vst)
    dist = [float('inf')] * n
    dist[vst] = 0
    q = []
    heappush(q, (0, vst))
    for _ in range(n):
        while True:
            min_dist, search_v = heappop(q)
            if checked_v[search_v] == 0:
                break
        checked_v[search_v] = 1
        for to_v in range(n):
            if checked_v[to_v] == 0:
                cost = graph[search_v][to_v]
                if dist[search_v] + cost < dist[to_v]:
                    dist[to_v] = dist[search_v] + cost
                    route[to_v] = route[search_v] + str(to_v)
                    heappush(q, (dist[to_v], to_v))
    return dist


h, w = map(int, input().split())
graph = np.array([np.array(list(map(int, input().split()))) for _ in range(10)])
graph = np.transpose(graph)
dist = dijkstra(graph, 10, vst=1)


wall_num = []
for i in range(h):
    wall_num += list(map(int, input().split()))



ret = 0
for num in wall_num:
    if num != -1:
        ret += dist[num]


print(ret)
X,Y,Z = map(int,input().split())
print(Z X Y)

### FIXED CODE ###

X,Y,Z = map(int,input().split())
print(Z,X,Y)
s = input()
n = len(s)
s = int(s)

countdic = {}
mod = 2019

for i in range(1,n+1):
    num = s[n-i:n]
    remainder = num%mod
    if remainder in countdic:
        countdic[remainder] += 1
    if remainder not in countdic:
        countdic[remainder] = 1

ans = 0
for key in countdic:
    ans += countdic[key]*(countdic[key]-1)//2

if 0 in countdic:
    ans += countdic[0]

print(ans)

### FIXED CODE ###

s = list(map(int, list(input())))
n = len(s)

countdic = {}
mod = 2019

num = 0
d = 1
for i in range(1,n+1):
    num += s[n-i]*d
    num %= mod
    if num in countdic:
        countdic[num] += 1
    if num not in countdic:
        countdic[num] = 1
    d = (10*d)%mod

ans = 0
for key in countdic:
    ans += countdic[key]*(countdic[key]-1)//2

if 0 in countdic:
    ans += countdic[0]

print(ans)
a,b,c = input().split()
str.capitalize(a,b,c)
print(a[0]+b[0]+c[0])


### FIXED CODE ###

a,b,c = input().split()
a_d=a.capitalize()
b_d=b.capitalize()
c_d=c.capitalize()
print(a_d[0]+b_d[0]+c_d[0])
w, h = map(int, input().split())
field = [list(input()) for _ in range(h)]

for y in range(h):
    for x in range(w):
        if field[y][x] == "#":
            try:
                if("#" in [field[y + 1][x], field[y - 1][x], field[y][x + 1], field[y][x - 1]]):
                    pass
                else:
                    print("No")
                    quit()
            except IndexError:
                False

print("Yes")

### FIXED CODE ###

h, w = map(int, input().split())
field = []
field.append(list("." * (w + 2)))
for _ in range(h):
    field.append(list("." + input() + "."))
field.append(list("." * (w + 2)))

for y in range(1, h + 1):
    for x in range(1, w + 1):
        if field[y][x] == "#":
                if("#" in [field[y + 1][x], field[y - 1][x], field[y][x + 1], field[y][x - 1]]):
                    pass
                else:
                    print("No")
                    quit()

print("Yes")
n=int(input())
l=list(map(int,str(bin(n))[2:]))
for i in range(1,len(l)+3): 
    if l[-i] == 2:
        l[-i] = 0
        if i == len(l):
            l.insert(0,1)
        else:
            l[-(i+1)]+=1
    if i%2==0 and l[-i]==1:
        if i == len(l):
            l.insert(0,1)
        else:
            l[-(i+1)]+=1
s = ''.join([str(x) for x in l])
print(s)

### FIXED CODE ###

n=int(input())
flg = 0
if n < 0:
    n *= -1
    flg = 1
l=list(map(int,str(bin(n))[2:]))
for i in range(1,len(l)+3): 
    try:
        if l[-i] == 2:
            l[-i] = 0
            if i == len(l):
                l.insert(0,1)
            else:
                l[-(i+1)]+=1
        if i%2==flg and l[-i]==1:
            if i == len(l):
                l.insert(0,1)
            else:
                l[-(i+1)]+=1
    except:
        pass
s = ''.join([str(x) for x in l])
print(s)
import sys

values = [int(input()) for i in range(int(input()))]
maxv = - 1000000
minv = values[0]

for value in enumerate(values):
    maxv = max(maxv, value - minv)
    minv = min(minv, value)
print(maxv)


### FIXED CODE ###

values = [int(input()) for _ in range(int(input()))]
maxv = values[1] - values[0]
minv = values[0]

for val in values[1:]:
    maxv = max(maxv, val - minv)
    minv = min(minv, val)         # 今までの最小値を保持(自分と自分を比較しない様に、最大値の評価後に計算)
print(maxv)
n,k=map(int,input().split())
ans=[None]*n
while k>0:
  d=input()
  a=list(map(int,input().split()))
  #print (d,a)
  for i in a:
    ans[i-1]=d
  k-=1
count=0
for item in ans:
  if item==None:
    count+=1
print (count)a

### FIXED CODE ###

n,k=map(int,input().split())
ans=[None]*n
while k>0:
  d=input()
  a=list(map(int,input().split()))
  #print (d,a)
  for i in a:
    ans[i-1]=d
  k-=1
count=0
for item in ans:
  if item==None:
    count+=1
print (count)
N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*N
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    dp[x] = 1
for i in range(1,N):
    t = dp[i]
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for x in Check:
        if dp[t-x]+1 == dp[t]:
            W[V[x]] += 1
            t -= x
            break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)


### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
s[] = input().split()

count = 0

if (s[0] == '1'):
    count++
if (s[1] == '1'):
    count++
if (s[2] == '1'):
    count++

print(count)

### FIXED CODE ###

print(input().count("1"))
l = list(map(int, input().split()))

c = 0
for x in l:
    if x == 0:
        print(c)
    c++

### FIXED CODE ###

l = list(map(int, input().split()))

c = 1
for x in l:
    if x == 0:
        print(c)
    c += 1
N = input()
K = input()
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))


### FIXED CODE ###

N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))
from math import floor

word = input()
num = int(input())
length=len(word)

char_before= ''
sum=0
subsum =0
count= 0
stack=[]

for index in range(length):
    char_now=word[index]
    if index == 0 :
        char_before = char_now
        char_first=char_now
        count = 1
        continue
    
    if char_before == char_now :
        count = count + 1
    else:
        char_before = char_now
        stack.append(count)
        count = 1
    
    if index == length-1:
        char_last=char_now
        stack.append(count)
        
for i in stack:
    subsum= subsum + floor(i/2)
    
if (stack[0]%2)==1 and (stack[-1]%2)==1 and char_last==char_first and len(stack)>=2:
    sum =(subsum+1)*num -1
elif len(stack)==1:
    sum = floor(length*num/2)
else:
    sum =(subsum)*num

print(sum)

### FIXED CODE ###

from math import floor

word = input()
num = int(input())
length=len(word)

char_before= ''
sum=0
subsum =0
count= 0
stack=[]

for index in range(length):
    char_now=word[index]
    if index == 0 :
        char_before = char_now
        char_first=char_now
        count = 1
        if length==1:
            char_last=char_now
            stack.append(count)
        continue
    
    if char_before == char_now :
        count = count + 1
    else:
        char_before = char_now
        stack.append(count)
        count = 1
    
    if index == length-1:
        char_last=char_now
        stack.append(count)

for i in stack:
    subsum= subsum + floor(i/2)
    
if (stack[0]%2)==1 and (stack[-1]%2)==1 and char_last==char_first and len(stack)>=2:
    sum =(subsum+1)*num -1
elif len(stack)==1:
    sum = floor(length*num/2)
else:
    sum =(subsum)*num

print(sum)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

time = 0
cnt = 0
ans = 0

def dfs(time, cnt):
    global ans
    # print(time)
    if time > K:
        # print(cnt)
        ans = max(ans, cnt-1)
        return
    if A:
        dfs(time+A.pop(0), cnt+1)
    if B:
        dfs(time+B.pop(0), cnt+1)
    if len(A)==0==len(B):
        return cnt

if sum(A)+sum(B)<=K:
    print(N+M)
else:
    dfs(0, 0)
    print(ans)

### FIXED CODE ###

from itertools import accumulate

N, M, K = map(int, input().split())
A = list(accumulate([0] + list(map(int, input().split()))))
B = list(accumulate([0] + list(map(int, input().split()))))


ans, j = 0, M

for i in range(N+1):
    if A[i] > K:
        break
    while B[j] > K-A[i]:
        j -= 1
    ans = max(ans, i+j)


print(ans)
n, k = map(int, input().split())
h = list(int(input()) for _ in range(n))

h.sort()

m = 10 ** 9
for i in range(n-2):
    temp = h[i+k-1] - h[i]
    m = min(m, temp)

print(m)

### FIXED CODE ###

n, k = map(int, input().split())
h = list(int(input()) for _ in range(n))

h.sort()

m = 10 ** 9
for i in range(n-k+1):
    temp = h[i+k-1] - h[i]
    m = min(m, temp)

print(m)
N, M = map(int, input().split())

ans = N*(N-1)/2 + M(M-1)/2

print(ans)

### FIXED CODE ###

N, M = map(int, input().split())

ans = N*(N-1)/2 + M*(M-1)/2

print(int(ans))
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input())
a = [int(input()) for i in range(n)]
r = 1
for i in a:
    r = lcm(r, i)
print(r)

### FIXED CODE ###

def gcd(x, y):
    if y==0:
        return x
    else:
        return gcd(y, x%y)

def lcm(x, y):
    return (x * y) // gcd(x, y)

n = int(input())
a = [int(input()) for i in range(n)]
r = 1
for i in a:
    r = lcm(r, i)
print(r)