Harryxun/stf_run huggingface dataset:
import math
import fractions
import copy
import numpy as np
import heapq
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""

def addbottom(total,tree,k,value,base):
    #print("current layer",k)
    #print(k,value)
    total[k]+=value
    #print(total)
    if len(tree[k]):
        for i in tree[k]:
            #print(k,i)
            total = addbottom(total, tree, i, value,base)
    return total


n ,m = ips()
tree = [[] for i in range(n+1)]
for i in range(n-1):
    x,y = ips()
    tree[x].append(y)
total = [0 for i in range(n+1)]
for i in range(m):
    x,adder = ips()
    total[x]+=adder
base = copy.copy(total)
for i in range(1,n):
    #print("adding up",i,base[i])
    value = base[i]
    if len(tree[i]):
        for k in tree[i]:
            total = addbottom(total,tree,k,value,base)
for i in range(1,n):
    print(total[i],end=" ")
print(total[n])

### FIXED CODE ###

import copy
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)

n ,m = ips()
tree = [[] for i in range(n+1)]
for i in range(n-1):
    x,y = ips()
    tree[x].append(y)
    tree[y].append(x)
total = [0 for i in range(n+1)]
for i in range(m):
    x,adder = ips()
    total[x]+=adder
base = copy.copy(total)
q = [1]
pos = 0
cs = set([1])
while len(q) > pos:
    #print("adding up",pos,q)
    i = q[pos]
    value = total[i]
    cs.add(i)
    if len(tree[i]):
        for k in tree[i]:
            if k not in cs:
                q.append(k)
                total[k]+=value
    pos+=1
for i in range(1,n):
    print(total[i],end=" ")
print(total[n])
def actual(N, M, X, A):
    # マスXの左右それぞれにある料金所の数を調べればOK
    toll_gates_left = [a_i for a_i in A if a_i < X]
    toll_gates_right = [a_i for a_i in A if X < a_i]

    return min(len(toll_gates_left), len(toll_gates_right))

N, M, X = map(int, input().split())
A = [int(input()) for _ in range(N + 1)]

print(actual(N, M, X, A))


### FIXED CODE ###

def actual(N, M, X, A):
    # マスXの左右それぞれにある料金所の数を調べればOK
    toll_gates_left = [a_i for a_i in A if a_i < X]
    toll_gates_right = [a_i for a_i in A if X < a_i]

    return min(len(toll_gates_left), len(toll_gates_right))

N, M, X = map(int, input().split())
A = list(map(int, input().split()))

print(actual(N, M, X, A))
a = input()
b = [int(c) for c in a]

d = len(a)
e = b + 1
i = 0
while i < e:
    e = a[i]
    if e == '7':
        print('Yes')
        break
    elif e == a:
          print('No')
        
    i += 1

    

### FIXED CODE ###

a = input()
if '7' in a:
   print('Yes')
else:
   print('No')
gomi=input()
tako= [i for i in input().split()]
print((sum(tako)**2-sum([i**2 for i in tako]))/2)

### FIXED CODE ###

gomi=input()
tako=[int(i) for i in input().split()]
print(int((sum(tako)**2-sum([i**2 for i in tako]))/2))
def gcd(num1,num2):
    if num2 == 0:
        return num1
    return gcd(num2,num1%num2)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

time = 1

for i in t:
    time = time * i / gcd(time,i)

print(time)

### FIXED CODE ###

n = int(input())
ans = int(input())
 
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
 
def lcm(x,y):
    return (x*y//gcd(x,y))
 
for i in range(n-1):
    t = int(input())
    ans = lcm(ans,t)
print(ans)
S = input()
L = len(s)
print( S[:2]+str(L-2) +S[(L-1):] )

### FIXED CODE ###

s = input()
print( s[0] + str(len(s)-2) + s[-1] )
N,X,T=map(int,input().split())
if N%X ==0:
    print(NT//x)
else:
    print(((N//X)+1)*T)


### FIXED CODE ###

N,X,T=map(int,input().split())
if N%X ==0:
    print(N*T//X)
else:
    print(((N//X)+1)*T)
import itertools
import numpy as np
import copy


ansl = []
N, A, B, C = list(map(int, input().split()))

a = []
for i in range(N):
    a.append(int(input()))

def get_ptn(la):
    ptn = []
    for i in range(1, len(la) + 1):
        ptn.append(list(itertools.combinations(la, i)))
    return ptn

takes = list(itertools.permutations([A, B, C]))


for take in takes:
    # print(take)
    # print(a)
    ta = copy.deepcopy(a)
    ans = 0
    for k in range(3):

        # print(a)
        ptn = get_ptn(ta)

        # print(ptn)
        cost = []
        tmp = []

        for i in range(len(ptn)):
            tmp.append([abs(take[k] - sum(j)) for j in ptn[i]])
            cost.append(min(tmp[i]) + 10 * i)
        # print(cost)
        ans += min(cost)
        ac = np.argmin(cost)
        # print(np.argmin(cost))
        # print(ptn[ac])
        # print(tmp[ac])
        at = np.argmin(tmp[ac])
        # print(ptn[ac][at])

        for _ in ptn[ac][at]:
            ta.remove(_)

    ansl.append(ans)

print(min(ansl))


### FIXED CODE ###

import itertools
import numpy as np
import copy


ansl = []
N, A, B, C = list(map(int, input().split()))

a = []
for i in range(N):
    a.append(int(input()))

def get_ptn(la):
    ptn = []
    for i in range(1, len(la) + 1):
        ptn.append(list(itertools.combinations(la, i)))
    return ptn

takes = list(itertools.permutations([A, B, C]))

for take in takes:
    # print(take)
    # print(a)
    try:
        ta = copy.deepcopy(a)
        ans = 0
        for k in range(3):
            # print(a)
            ptn = get_ptn(ta)

            # print(ptn)
            cost = []
            tmp = []
            for i in range(len(ptn)):
                tmp.append([abs(take[k] - sum(j)) for j in ptn[i]])
                cost.append(min(tmp[i]) + 10 * i)
            ans += min(cost)
            ac = np.argmin(cost)
            # print(np.argmin(cost))
            # print(ptn[ac])
            # print(tmp[ac])
            at = np.argmin(tmp[ac])
            # print(ptn[ac][at])

            for _ in ptn[ac][at]:
                ta.remove(_)

        ansl.append(ans)
    except:
        pass

print(min(ansl))
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * 10 ** 5
h = h + [INF] * 10 ** 5

dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))

print(dp[n - 1])


### FIXED CODE ###

import sys
input = sys.stdin.readline

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * (n + k + 10)
dp[0] = 0

for i in range(n):
    for j in range(1, k + 1):
        if i + j < n:
            if dp[i + j] == float('inf'):
                dp[i + j] = dp[i] + abs(h[i + j] - h[i])
            else:
                dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
        else:
            break


print(dp[n-1])
n = int(input())
command = [input().split() for i in range(n)]
ans = []
for i in range(n):
    if command[i][0] == "insert":
        ans.insert(0, command[i][1])
    elif command[i][0] == "delete":
        ans.remove(command[i][1])
    elif command[i][0] == "deleteFirst":
        ans.pop(0)
    else:
        ans.pop()

print (' '.join(ans))

### FIXED CODE ###

# -*- coding:utf-8 -*-
import collections
n = int(input())
ans = collections.deque()

for i in range(n):
    command = input().split()
    if command[0] == "insert":
        ans.appendleft(command[1])
    elif ans == []:
        continue
    elif command[0] == "delete":
        try:
            ans.remove(command[1])
        except:
            pass
    elif command[0] == "deleteFirst":
        ans.popleft()
    else:
        ans.pop()

print (' '.join(ans))
N=int(input())
A=map(int,input().split())
m=10**9+7
r=1
C=[0,0,0]
for a in A:
    i=C.index(a)
    r=r*sum([1 if c==a else 0 for c in C])%m
    C[i]+=1
print(r)

### FIXED CODE ###

N=int(input())
A=map(int,input().split())
m=10**9+7
r=1
C=[0,0,0]
for a in A:
    try:
        i=C.index(a)
        r=r*sum([1 if c==a else 0 for c in C])%m
        C[i]+=1
    except:
        print(0)
        exit()
print(r)
n = int(input())
h = list(map(int, input().split()))

memo = [-1] * n
def cost(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1] - h[0])
  else:
    if memo[i] == -1:
      cost1 = cost(i-2) + abs(h[i] - h[i-2])
      cost2 = cost(i-1) + abs(h[i] - h[i-1])
      memo[i] = min(cost1, cost2)
    return memo[i]
print(cost(n-1))

### FIXED CODE ###

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

cost = [0] * (n + 1)
cost[0] = 0
cost[1] = abs(h[1] - h[0])

for i in range(2, n):
  cost1 = cost[i-2] + abs(h[i] - h[i-2])
  cost2 = cost[i-1] + abs(h[i] - h[i-1])
  cost[i] = min(cost1, cost2)
print(cost[n-1])
N,A = map(int,input().split())
a = N%500
if a<=A:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')
a,b=map(input().split())
if a="H" and b="H":
  print("H")
elif a="H" and b="D":
  print("D")
elif a="D" and b="H":
  print("D")
elif a="D" and b="D":
  print("H")

### FIXED CODE ###

a,b=input().split()
if a=="H" and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")
n=int(input())
s=list(input())
#前処理
for i in range(0,2*n,2):
    if s[i]=='W':
        s[i]='B'
    else:
        s[i]='W'

#Lの数を数えてRとマッチング
countL=0
ans=1
for i in range(2*n):
    if s[i]=='W':
        countL+=1
    else:
        ans*=countL
        if countL==0:
            print(0)
            exit()
        countL-=1
# 答えはansの階乗
ans=ans%(10**9+7)
for i in rangea(1,n+1):
    ans*=i
    ans%(10**9+7)
print(ans)




### FIXED CODE ###

mod=10**9+7
n=int(input())
s=list(input())
#前処理
for i in range(0,2*n,2):
    if s[i]=='W':
        s[i]='B'
    else:
        s[i]='W'

#Lの数を数えてRとマッチング
countL=0
ans=1
for i in range(2*n):
    if s[i]=='W':
        countL+=1
    else:
        ans*=countL
        if countL==0:
            print(0)
            exit()
        ans%=mod
        countL-=1
if countL!=0:
    print(0)
    exit()
# 答えはansの階乗
for i in range(1,n+1):
    ans*=i
    ans%=mod
print(ans)
coin_value = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
  result += value * (x // coin)
  x = x - x // coin * coin
  
print(result)

### FIXED CODE ###

coin_values = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
    result += value * (x // coin)
    x = x - x // coin * coin
  
print(result)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

ans -= 10-min(x)
print(ans)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

if x != []:
  ans -= 10-min(x)
print(ans)
N = int(input())
I =[list(map(int, input().split())) for i in range(N)]

for Cx in range(101):
    for Cy in range(101):
         ans = []
        for ix, iy, ih in I:
            ans.append(abs(ix - Cx) + abs(iy - Cy) + ih)
            ans = [a for a in ans if a > 0]
        if len(ans) > 1:
            continue
        for ix, iy, ih in I:
            if max(a - abs(ix - Cx) - abs(iy - Cy), 0) != ix:
                break
        else:
            print(Cx, Cy, a)
            exit()
        
                        



### FIXED CODE ###

N = int(input())
Info = [list(map(int, input().split())) for i in range(N)]
Info_nonzero = []
highest = 0
for x, y, h in Info:
    if h != 0:
        Info_nonzero.append([x, y, h])

for x, y, h in Info:
    if h == 0:
        highest = max(highest, x + y)

for Cx in range(101):
    for Cy in range(101):
        candidate_set = set()
        for x, y, h in Info_nonzero:
            H = abs(Cx - x) + abs(Cy - y) + h
            candidate_set.add(H)

        ans_H = list(candidate_set)[0]
        if len(candidate_set) == 1:
            for x, y, h in Info:
                H = abs(Cx - x) + abs(Cy - y) + h
                if h == 0:
                    if not H >= ans_H:
                        break

                if h != 0:
                    if not H <= ans_H:
                        break
            else:
                print(Cx, Cy, abs(Cx - Info_nonzero[0][0]) + abs(Cy - Info_nonzero[0][1]) + Info_nonzero[0][2])
                exit()
S = raw_input()
S = int(S)
h = S / 3600
m = (S - h * 3600) / 60
s = S - 3600 * h - 60 * m
print h: , m: , s

### FIXED CODE ###

S = raw_input()
S = int(S)
h = S / 3600
m = (S - h * 3600) / 60
s = S - 3600 * h - 60 * m

print "%d:%d:%d" % (h,m,s)
# coding: utf-8
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def bin_ser(x):
    l=-1
    r=n+1
    while r-l>1:
        i=(l+r)//2
        
        if A[i]==x:
            return i
        
        if A[i]<x:
            l=i
        else:
            r=i
            
    return i

for i in range(m):
    B,C=map(int,input().split())
    k=bin_ser(C)
    for j in range(min(B,k)):
        A.insert(k,C)
        A.pop(0)

print(sum(A))

### FIXED CODE ###

from operator import itemgetter as ite

n,m=map(int,input().split())
A=list(map(int,input().split()))
BC=[]
for i in range(m):
    BC.append(list(map(int,input().split())))
A.sort()
BC.sort(key=ite(1),reverse=True)

k=0
cnt=0

for i in range(n):
    if A[i]<BC[k][1]:
        A[i]=BC[k][1]
        cnt+=1
        if cnt==BC[k][0]:
            k+=1
            cnt=0
            if k==len(BC):
                break
    else:
        break

ans=sum(A)
print(ans)
S=input()
l=len(S)
num=0
for i in range(l):
  if S[i] in "AGCT":
    num+=1
  elif num>ans:
    ans=num
    num=0
  else:
    num=0
print(ans)

### FIXED CODE ###

S = input()

ans = 0
tmp = 0
flag = False

for i in S:
    if (i == "A") or (i == "C") or (i == "G") or (i == "T"):
        tmp += 1
        flag = True
    elif (tmp > ans) and flag:
        ans = tmp
        tmp = 0
        flag = False
    elif flag:
        tmp = 0
        flag = False

if (ans < tmp):
    ans = tmp

print(ans)
def prime_number(x):
    divisor_lst = [1,x]
    for i in range(1,x+1):
        if i not in divisor_lst and x%i==0:
            return False
        break
    else:
        return True

n = int(input())

if prime_number(n):
    print(n-1)
else:
    i = 1
    j = n//i
    divisor_lst = []
    while i<=j:
        i += 1
        j = n//i
        if n%i==0:
            divisor_lst.append([i,j])

    n_x = divisor_lst[-1][0]
    n_y = divisor_lst[-1][1]
    print(n_x+n_y-2)

### FIXED CODE ###

n = int(input())

need_lst = []
for i in range(1,int(n**(1/2)+1)):
    if n%i==0:
        need = i+n//i
        need_lst.append(need-2)

print(min(need_lst))
N, M = list(map(int, input().split()))
P = []
S = []

def f(s):
  lst = s.split()
  return int(lst[0]),lst[1]



for i in range(M):
  p, s = f(input())
  P.append(p)
  S.append(s)

correct = 0
penalty = 0
q = []
relate = []

for i, j in enumerate(S):
  if 'AC' in j:
    if P[i] not in q:
      q.append(P[i])
      relate.append(P[i])
      correct += 1
    else:
      relate.append(P[i])
      continue
  if 'WA' in j:
    if P[i] not in q:
        penalty += 1
    else:
      continue

for i, j in enumerate(S):
  if 'WA' in j:
    if P[i] not in relate:
      peanlty -= 1

print(correct, penalty)

### FIXED CODE ###


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

isAC = [0] * (N+1)
isWA = [0] * (N+1)

ACnum = 0
WAnum = 0

for _ in range(M):
    p, s = input().split()
    p = int(p)

    if isAC[p] == 1: continue
    if s == 'AC':
        isAC[p] = 1
        ACnum += 1
        WAnum += isWA[p]
    elif s == 'WA':
        isWA[p] += 1

print("%d %d"%(ACnum, WAnum))
import streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes
proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0)
proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y
proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y

var
    L = stdin.readLine.split.map(parseInt)
    N = L[0]
    K = L[1]
    A = stdin.readLine.split.map(parseInt)
    MOD = 10^9 + 7
    ans = 0.int64
    jun = newSeqWith(N, 0)
    inv = newSeqWith(N, 0)
for i in 0..N-1:
    for j in 0..N-1:
        if j < i:
            if A[i] < A[j]:
                jun[i] += 1
        else:
            if A[i] < A[j]:
                inv[i] += 1
for i in 0..N-1:
    ans += K * (((jun[i] * (K+1)) + (inv[i] * (K-1))) div 2)
    ans %= MOD
    # ans += (inv[i] * (K-1)) mod MOD
    # ans %= MOD
echo ans mod MOD

### FIXED CODE ###

# coding: utf-8
N, K = map(int, input().split())
mod = 10**9 + 7
A = list(map(int, input().split()))
l = []
for i in range(N):
    tmp = [0, 0]
    for j in range(N):
        if j < i:
            if A[i] < A[j]:
                tmp[0] += 1
        else:
            if A[i] < A[j]:
                tmp[1] += 1
    l.append(tmp[:])
ans = 0
for i in range(N):
    ans += l[i][0]*K*(K+1) // 2
    ans %= mod
    ans += l[i][1] * K * (K - 1) // 2
    ans %= mod
print(ans % mod)
n,*a=map(int,open(0).read().split())
a.sort()
print(sum(abs(i)for i in a)-2*abs(a[0]))
if n==2:
    print(a[1]-1[0])
    print(a[1],a[0])
else:
    print(a[0],a[-1])
    a[0]-=a[-1]
    for i in a[1:-2]:
        print(a[0],i)
        a[0]-=i
    print(a[-2],a[0])

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
a.sort()
print(sum(abs(i)for i in a)-2*min(abs(a[-1]),abs(a[0]))*(a[0]*a[-1]>0))
if a[0]>0:
    print(a[0],a[-1])
    a[0]-=a[-1]
    for i in a[1:-2]:
        print(a[0],i)
        a[0]-=i
    print(a[-2],a[0])
elif a[-1]<0:
    for i in a[:-1]:
        print(a[-1],i)
        a[-1]-=i
else:
    for i in a[1:-1]:
        if i<0:
            print(a[-1],i)
            a[-1]-=i
        else:
            print(a[0],i)
            a[0]-=i
    print(a[-1],a[0])
N = int(input())
S = input()

if N % 2 == 1:
  print("No")
else:
  half = N/2
  ans = "Yes"
  for i in range(half):
    if S[i] != S[i+half]:
      ans = "No"
      break
  print(ans)

### FIXED CODE ###

N = int(input())
S = input()

if N % 2 == 1:
  print("No")
else:
  half = int(N/2)
  ans = "Yes"
  for i in range(half):
    if S[i] != S[i+half]:
      ans = "No"
      break
  print(ans)
import math


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


A, B, C, D = map(int, input().split())

AtoB = (B - (A - 1))

divisible_C = (B // C) - ((A - 1) // C)
divisible_D = (B // D) - ((A - 1) // D)

minLcm = lcm(C, D)

divisible_CD = (B // minLcm) - ((A - 1) // minLcm)

divisible_CtoD = (divisible_C + divisible_D) - divisible_CD

answer = AtoB - divisible_CtoD

print(answer)

### FIXED CODE ###

import fractions


def lcm(x, y):
    aaa = (x * y) // fractions.gcd(x, y)
    return aaa


A, B, C, D = map(int, input().split())

AtoB = (B - (A - 1))

divisible_C = (B // C) - ((A - 1) // C)
divisible_D = (B // D) - ((A - 1) // D)

minLcm = lcm(C, D)

divisible_CD = (B // minLcm) - ((A - 1) // minLcm)

divisible_CtoD = (divisible_C + divisible_D) - divisible_CD

answer = AtoB - divisible_CtoD

print(answer)
K = int(input())
A, B = map(int, input().split())
cnt = 0
while true:
  cnt+=K
  if a <= cnt <= b:
    print("OK")
    break
  if b < cnt:
    print("NG")
    break

### FIXED CODE ###

K = int(input())
A, B = map(int, input().split())
cnt = 0
while 1:
  cnt+=K
  if A <= cnt <= B:
    print("OK")
    break
  if B < cnt:
    print("NG")
    break
import numpy as np

n, w = list(map(int, input().split()))
wv = np.array([list(map(int, input().split())) for i in range(n)])

dp = np.zeros((w + 1, n))
dp[w[0, 0] :, 0] = np.full(dp[w[0, 0] :, 0].shape, w[0, 1])
for i in range(1, n):
    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i, 0], wv[i, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n - 1])


### FIXED CODE ###

import numpy as np


def main():
    N, W = list(map(int, input().split(' ')))
    items = np.array([list(map(int, input().split(' '))) for _ in range(N)])
    dp = np.zeros((N, W + 1))
    dp[0, items[0, 0]:] = items[0, 1]
    for n in range(1, N):
        weight, value = items[n, 0], items[n, 1]
        dp[n, :] = dp[n - 1, :]
        dp[n, weight:] = np.fmax(
            dp[n, weight:],
            value + dp[n - 1, :(- weight)]
        )
    print(int(dp[N - 1, W]))


if __name__ == '__main__':
    main()
str = input()

res = str[0:1] + str(len(str)-2) +str[0:1:-1]
print(res)

### FIXED CODE ###

s = input()

res = s[0] + str(len(s)-2) + s[len(s)-1]

print(res)
n, m = map(int, input().split())
ab = [(lambda x, y:(x, y))(*map(int, input().split())) for _ in range(m)]
d = {}
for x in ab:
  if x[0] in d.keys():
    d[x[0]].append(x[1])
  else:
    d[x[0]] = [x[1]]
moyo = []
for z in d[1]:
  moyo += d[z]
for z in moyo:
  if z == n:
    exit(print('POSSIBLE'))
print('IMPOSSIBLE')

### FIXED CODE ###

n, m = map(int, input().split())
ab = [(lambda x, y:(x, y))(*map(int, input().split())) for _ in range(m)]
d = {}
for x in ab:
  if x[0] in d.keys():
    d[x[0]].append(x[1])
  else:
    d[x[0]] = [x[1]]
moyo = []
for z in d[1]:
  if z in d.keys():
    moyo += d[z]
for z in moyo:
  if z == n:
    exit(print('POSSIBLE'))
print('IMPOSSIBLE')
S = ["Sunny","Cloudy","Rainy"]
s = input()
for i in range(len(S)):
    if(i == len(S)):
        print(S[0])
        break
    if(S[i] == s):
        print(S[i+1])
        break

### FIXED CODE ###

S = ["Sunny","Cloudy","Rainy"]
s = input()
for i in range(len(S)):
    if(i == len(S)-1):
        print(S[0])
        break
    if(S[i] == s):
        print(S[i+1])
        break
import sys

a, b = tuple([int(x)for x in sys.stdin.readline().split()])
diff = max(a, b) - min(a, b)

c = 0
for i in range(1, 1000):
    if diff == i:
        print(c - a)
        break
    c += i

### FIXED CODE ###

import sys

N = int(sys.stdin.readline())                                                                                                                                                        
if N < 1000:
    print('ABC')
else:
    print('ABD')
n = input()
print n[0:4]

### FIXED CODE ###

str = input()
print(str[:3] + "8" + str[4:])
power = [i for i in range(2, 12+1)] + [1]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')

### FIXED CODE ###

power = [i for i in range(2, 13+1)] + [1]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')