Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
O = str(input())
E = str(input())
a = []
if len(O) == len(E):
  for i in range(len(O)):
    a.append(O[i]+E[i])
else:
  for i in range(len(O)):
    a.append(O[i]+E[i])
  a.append(O[-1])
L = "".join(a)
print(L)

### FIXED CODE ###

# -*- coding: utf-8 -*-
O = str(input())
E = str(input())
a = []
if len(O) == len(E):
  for i in range(len(O)):
    a.append(O[i]+E[i])
else:
  for i in range(len(O)-1):
    a.append(O[i]+E[i])
  a.append(O[-1])
L = "".join(a)
print(L)
N = input()
print(N^3)

### FIXED CODE ###

N = int(input())
print(N**3)
import copy
import random
d = int(input())
c = list(map(int,input().split()))
s = []
t = [0 for _ in range(d)]
for i in range(d):
  si = list(map(int,input().split()))
  s.append(si)
lastd = [-1 for _ in range(26)]
for i in range(d):
  mx = 0
  mj = 0
  for j in range(26):
    if s[i][j] + (i-lastd[j])*c[j] > mx:
      mx = s[i][j] + (i-lastd[j])*c[j]
      mj = j
  lastd[mj] = i
  t[i] = mj
lastd = [-1 for _ in range(26)]
ans = 0
for i in range(d):
  di = t[i]
  lastd[di-1] = i
  ans += s[i][di-1]
  for j in range(26):
    ans -= (i-lastd[j])*c[j]
mxans = ans
mxt = copy.deepcopy(t)
for time in range(80000):
  da = random.randint(0, d-1)
  qb = t[da]
  if random.random() < 0.7:
    bord = c[qb]*(0.7)
    qac = []
    cap = qac.append
    for i in range(0,qb):
      if s[da][i] > bord:
        cap(i)
      continue
    for i in range(qb+1,26):
      if s[da][i] > bord:
        cap(i)
      continue
    if len(qac) == 0:
      continue
    qa = random.choice(qac)
  else:
    bord = c[qb]//2
    qac = []
    cap = qac.append 
    for i in range(0,qb):
      if c[i] > bord:
        cap(i)
    for i in range(qb+1,26):
      if c[i] > bord:
        cap(i)
    if len(qac) == 0:
      continue
    qa = random.choice(qac) 
  #print(da,qb,qa,t)
  qb1 = -1
  qa1 = -1
  for i in range(da-1,-1,-1):
    if t[i] == qb:
      qb1 = i
      break
  for i in range(da-1,-1,-1):
    if t[i] == qa:
      qa1 = i
      break
  qb2 = d
  qa2 = d
  for i in range(da+1,d):
    if t[i] == qb:
      qb2 = i
      break
  for i in range(da+1,d):
    if t[i] == qa:
      qa2 = i
      break
  delta = -s[da][qb]+s[da][qa]-c[qb]*(qb2-da)*(da-qb1)+c[qa]*(qa2-da)*(da-qa1)
  if delta > 0:
    t[da] = qa
    ans += delta
    if ans > mxans:
      mxans = ans
      mxt = copy.deepcopy(t)
  else:
    if random.random() < math.exp(delta/(10*time)):
      t[da] = qa
  #print(mxans)
for ansd in mxt:
  print(ansd+1)

### FIXED CODE ###

d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
  si = list(map(int,input().split()))
  s.append(si)
lastd = [-1 for _ in range(26)]
for i in range(d):
  mx = 0
  mj = 0
  #s = 0
  #for j in range(26):
    #s += (i-lastd[j])*c[j]
  for j in range(26):
    if s[i][j] + (i-lastd[j])*c[j] > mx:
      mx = s[i][j] + (i-lastd[j])*c[j]
      mj = j
  lastd[mj] = i
  print(mj+1)
from sys import stdin
h, w = [int(x) for x in stdin.readline().rstrip().split()]
matrix = [stdin.readline().rstrip() for _ in range(h)]
for i in range(h):
    matrix[i] = [matrix[i][x:x+1] for x in range(len(matrix[i]))]
    matrix[i] = [0 if x == '.' else x for x in matrix[i]]
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            for n in range(-1, 2):
                for m in range(-1, 2):
                    i_n = i + n
                    j_m = j + m
                    if matrix[i_n][j_m] != '#' and i_n >= 0 and j_m >= 0:
                        matrix[i_n][j_m] += 1

print(*matrix, sep = '\n')

### FIXED CODE ###

from sys import stdin
h, w = [int(x) for x in stdin.readline().rstrip().split()]
matrix = [stdin.readline().rstrip() for _ in range(h)]
for i in range(h):
    matrix[i] = [matrix[i][x:x+1] for x in range(len(matrix[i]))]
    matrix[i] = [0 if x == '.' else x for x in matrix[i]]
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            for n in range(-1, 2):
                for m in range(-1, 2):
                    i_n = i + n
                    j_m = j + m
                    if h > i_n >= 0 and w > j_m >= 0 :
                    	if matrix[i_n][j_m] != '#':
                        	matrix[i_n][j_m] += 1
for i in range(h):
  for j in range(w):
  	print('{}'.format(matrix[i][j]), end = '')
  print('')
a, b = map(int,input().split())
d = (int)a/b
r = a%b
f = a/b
print("%s %s %.5f" %(d,r,f))

 

### FIXED CODE ###

a, b = map(int,input().split())
d = a // b 
r = a % b
f = a / b
print("%d %d %f" %(d,r,f))
n,t=(int(x) for x in input().split())
t=t//1000
for y in range(((t-n)//4)+4):
    if (t-n-(4*y))%9 == 0:
        z=(t-n-(4*y))//9
        if n-y-z>=0:
            x=n-y-z
            print(x,y,z)
            break
else:
    print(-1,-1,-1)

### FIXED CODE ###

a=int(input())
repeat=""
for i in range(a):
    repeat=repeat+"ACL"
print(repeat)
N = int(input())
D, X = map(int, input().split())
a = []
for i in range(N):
    a.append(input())
sum = 0
for i in range(N):
    sum += int((D-1) / a[i] + 1)
print(sum+X)

### FIXED CODE ###

N = int(input())
D, X = map(int, input().split())
a = []
for i in range(N):
    a.append(int(input()))
sum = 0
for i in range(N):
    sum += int((D-1) / a[i] + 1)
print(sum+X)
#!/usr/bin/env python3

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

if m != 0:
    a = [int(input()) for _ in range(m)]

mod = 1000000007

if n == 1:
    print(1)
    exit()
elif n == 2:
    if a[0] == 1:
        print(1)
    else:
        print(2)
    exit()

if a[0] == 1:
    a_2, a_1 = 1, 0
    index = 1
else:
    a_2, a_1 = 1, 1
    index = 0

for i in range(2, n+1):
    if index < len(a):
        if i == a[index]:
            a_now = 0
            index += 1
            a_1, a_2 = a_now, a_1
            continue

    a_now = (a_1+a_2) % mod
    # print(a_now)
    a_1, a_2 = a_now, a_1
    # print(a_now)
print(a_now % mod)

# 0, 1, 2, 3, 4, 5, 6

# 1, 1, 2, 0, 2, 2, 4


### FIXED CODE ###

#!/usr/bin/env python3

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

if m != 0:
    a = [int(input()) for _ in range(m)]
else:
    a = [-1]

mod = 1000000007

if n == 1:
    print(1)
    exit()
elif n == 2:
    if a[0] == 1:
        print(1)
    else:
        print(2)
    exit()


if a[0] == 1:
    a_2, a_1 = 1, 0
    index = 1
else:
    a_2, a_1 = 1, 1
    index = 0

for i in range(2, n+1):
    if index < len(a):
        if i == a[index]:
            a_now = 0
            index += 1
            a_1, a_2 = a_now, a_1
            continue

    a_now = (a_1+a_2) % mod
    # print(a_now)
    a_1, a_2 = a_now, a_1
    # print(a_now)
print(a_now % mod)

# 0, 1, 2, 3, 4, 5, 6

# 1, 1, 2, 0, 2, 2, 4
print((A-1)*(B-1))

### FIXED CODE ###

A,B=map(int,input().split())
print((A-1)*(B-1))
n = int(input())

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

m = int(input())

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

max_diff = max(max(d),max(t))

diff = [0]*(max_diff+1)

for i in d:
    diff[i] += 1

flag = True

print(1111111)

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        flag = False
        break

if flag:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        print('NO')
        exit()
 
print('YES')
n,a,b=map(int input.split())
print(max(n*a,b))

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(a * n, b))
n,k = map(int,input().split())
li = list(map(int,input().split()))

start = 0
atesaki = 0
start_li = [0]
atesaki_li = []
count = 0
target = atesaki
for i in range(k):
    atesaki = li[start]-1
    start = atesaki
    if atesaki in atesaki_li:
        count = i+1
        break
    else:
        atesaki_li.append(atesaki)
    #print(atesaki,'tes')

first_ind = atesaki_li.index(atesaki)+1
#print(atesaki_li,atesaki,first_ind)

atesaki_li[(k-len(atesaki_li))%(len(atesaki_li)-first_ind+1)]
print(atesaki_li[(k-len(atesaki_li))%(len(atesaki_li)-first_ind+1)])+1

### FIXED CODE ###

n,k = map(int,input().split())
li = [0]+list(map(int,input().split()))

memo = [-1]*(n+1)
start = 1
syuuki = 0
haji = 0

for i in range(k):
    if memo[start] != -1:
        syuuki = i - memo[start]
        haji = memo[start]
        break
    memo[start] = i
    start = li[start]
else:
    print(start)
    exit()

#print(syuuki,haji)
k-=haji
k%=syuuki
k+=haji

start = 1
for kk in range(k):
    start = li[start]
print(start)
n,q = map(int, input().split())
cs = list(map(int, input().split()))

prevs = [-1] * n
# 左端
sts = [-1] * n
for i,c in enumerate(cs):
    if prevs[c] != -1:
        sts[prevs[c]] = i
    prevs[c] = i

qs = [[] for i in range(n)] 
for i in range(q):
    l,r = map(int, input().split())
    l -= 1
    r -= 1
    qs[l].append((r,i))

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n+10)

    def add(self, x, w):
        while x <= self.n:
            self.bit[x] += w
            x += x&-x

    def sum(self, x):
        cnt = 0
        while x > 0:
            cnt += self.bit[x]
            x -= x&-x
        return cnt

bit = BIT(n)
ans = [0] * q
for l in range(n-1,-1,-1):
    # 矢印を追加
    if sts[l] != -1:
        bit.add(sts[l], 1)
    for r,i in qs[l]:
        cnt = bit.sum(r)
        ans[i] = r - l + 1 - cnt

print(*ans, sep="\n")

### FIXED CODE ###

n,q = map(int, input().split())
cs = list(map(int, input().split()))

prevs = [-1] * (n+1)
# 左端
sts = [-1] * n
for i,c in enumerate(cs):
    c -= 1
    if prevs[c] != -1:
        sts[prevs[c]] = i
    prevs[c] = i

qs = [[] for i in range(n)] 
for i in range(q):
    l,r = map(int, input().split())
    l -= 1
    r -= 1
    qs[l].append((r,i))

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n+10)

    def add(self, x, w):
        while x <= self.n:
            self.bit[x] += w
            x += x&-x

    def sum(self, x):
        cnt = 0
        while x > 0:
            cnt += self.bit[x]
            x -= x&-x
        return cnt

bit = BIT(n)
ans = [0] * q
for l in range(n-1,-1,-1):
    # 矢印を追加
    if sts[l] != -1:
        bit.add(sts[l], 1)
    for r,i in qs[l]:
        cnt = bit.sum(r)
        ans[i] = r - l + 1 - cnt

print(*ans, sep="\n")
# input
N = int(input())
noguchi = [1000 * n for n in range(1, 11)]

# check
print(min([ngc - N for ngc in noguchi if (ngc - N) > 0]))


### FIXED CODE ###

# input
N = int(input())
noguchi = [1000 * n for n in range(1, 11)]

# check
print(min([ngc - N for ngc in noguchi if (ngc - N) >= 0]))
a,b= input().split()

#a='3'
#b='1,1'
aa=int(a)
bb=float(b)
print(int(aa*bb))a,b=map(float,input().split())

from decimal import*
A=Decimal(str(a))
AA=A.quantize(Decimal('0'),rounding=ROUND_FLOOR)
B=Decimal(str(b))
BB=B.quantize(Decimal('0.01'),rounding=ROUND_FLOOR)

K=AA*BB
print(int(K))

### FIXED CODE ###

a,b=input().split()
#a=10
#b=9.99
from decimal import*
A=Decimal(str(a))
AA=A.quantize(Decimal('0'),rounding=ROUND_FLOOR)
B=Decimal(str(b))
BB=B.quantize(Decimal('0.01'),rounding=ROUND_FLOOR)
#print(AA)
#print(BB)
K=AA*BB
KK=K.quantize(Decimal('0'),rounding=ROUND_FLOOR)
print(KK)

#a='10'
#b='9.99'
#aa=int(a)
#bb=float(b)
#print(int(aa*bb))
n,k=map(int,input().spkit())
print(k*(k-1)**(n-1))

### FIXED CODE ###

n,k=map(int,input().split())
print(k*(k-1)**(n-1))
A,B = map(int, input().split())
print(max(A+B,A−B,A*B))

### FIXED CODE ###

A,B = map(int, input().split())
print(max(A+B,A-B,A*B))
import math

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

M=A[0]
gcd=A[0]
for i in range(n-1):
    M=max(M,A[i+1])
    gcd=math.gcd(gcd,A[i+1])

if k<=M:
    if gcd==1:
        print("POSSIBLE")
    elif k%gcd==0:
            print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

import fractions

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

M=A[0]
g=A[0]
for i in range(n-1):
    M=max(M,A[i+1])
    g=fractions.gcd(g,A[i+1])

if k<=M:
    if g==1:
        print("POSSIBLE")
    elif k%g==0:
            print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    print("IMPOSSIBLE")
N,M=map(int,input().split())
A=list((map(int,input().split())))
 
m=[[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]
B=[]
 
for a in A:
    B.append(m[a-1])
    
maxlist=[0]*(N+10)
 
for i in range(N+1):
    if i!=0 and maxlist[i]==0:
        continue
    else:
        for b in B:
            if int(str(maxlist[i])+str(b[0])) > maxlist[i+b[1]]:
                maxlist[i+b[1]] = concat(maxlist[i],b[0])
 
print(maxlist[N])

### FIXED CODE ###

N,M=map(int,input().split())
A=list((map(int,input().split())))
 
m=[[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]
B=[]
    
for a in A:
    B.append(m[a-1])

if [5,5] in B:
    if [2,5] in B:
        B.remove([2,5])
    if [3,5] in B:    
        B.remove([3,5])

if [3,5] in B and [2,5] in B:
    B.remove([2,5])

if [7,3] in B:
    if [6,6] in B:
        B.remove([6,6])
    if [9,6] in B:
        B.remove([9,6])
    
if [9,6] in B and [6,6] in B:
    B.remove([6,6])

if [1,2] in B and [7,3] in B:
    if [2,5] in B:
        B.remove([2,5])
    if [3,5] in B:
        B.remove([3,5])
    if [5,5] in B:
        B.remove([5,5])
    if [8,7] in B:
        B.remove([8,7])

if [1,2] in B and ([2,5] in B or [3,5] in B or [5,5] in B) and [8,7] in B:
    B.remove([8,7])
    
if [4,4] in B and [7,3] in B and [8,7] in B:
    B.remove([8,7])
    
if [1,2] in B and [4,4] in B:
    B.remove([4,4])

maxlist=[""]*(N+1)
 
for i in range(N+1):
    if i!=0 and maxlist[i]=="":
        continue
    else:
        for b in B:
            if i+b[1]>N:
                continue
            ans=maxlist[i]+str(b[0])
            _max=maxlist[i+b[1]]
            if len(ans)<len(_max):
                continue
            elif len(ans)>len(_max):
                maxlist[i+b[1]] = ans
            else:
                for j in range(len(ans)):
                    if ans[j]<_max[j]:
                        break
                    if ans[j]>_max[j]:
                        maxlist[i+b[1]] = ans
                        break
 
print(maxlist[N])
N = map(int,input())
A = [list(map(int,input().split())) for i in range(N)]
dup = [i for i in set(A) if A.count(i) > 1]
print("NO" if dup else "YES")


### FIXED CODE ###

def has_duplicates(seq):
    return len(seq) != len(set(seq))
    
N = map(int,input())
A = list(map(int,input().split()))
print("NO" if has_duplicates(A) else "YES")
a = list(map(int,input().split()))
W = a[0]
H = a[1]
x = a[2]
y = a[3]
#W,H,x,y = list(map(int,input().split(" ").rstrip("")))
#print(W,H,x,y)
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
        
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
        
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
        
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
        
    elif float(x) == float(W)/2.0:
        tatemax = float(H) * float(x)
if W!=H:
    if yokomax == tatemax:
    #    print(max(yokomax,tatemax),'1')   
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')
    else:
    #    print(max(yokomax,tatemax),'0')
        print('{:.12e}'.format(max(yokomax,tatemax)),'0')
elif W ==H:
    if x !=0 and x != W and y!= 0 and y != H:
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')

### FIXED CODE ###

x,a = list(map(int,input().split()))
if x < a:
    print(0)
elif x >= a:
    print(10)
N, K = map(int,input().split())

if N%K=0:
   print(0)
else:
   print(1)

### FIXED CODE ###

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

if N%K==0:
   print(0)
else:
   print(1)
n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")

### FIXED CODE ###

n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2:
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")
import numpy as np
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
            if(c%calc==0):
                S+=calc
            else:
                S+=np.gcd(calc,c)
 
print(S)

### FIXED CODE ###

from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)
length = int(input())  
 
data = ([int(input()) for i in range(length)])

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  if cnt >= data[0]: 
    cnt = -1
    break
  cnt += 1
  
print(cnt)

### FIXED CODE ###

N = int(input())  
 
data = ([int(input()) for i in range(N)])

data.insert(0, 0)

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  if cnt >= N: 
    cnt = -1
    break
  cnt += 1
  
print(cnt)
o = input()
e = input()
x = []
if len(o) = len(e):
  for i in range(len(o)):
    x.append(o[i]+e[1])
else len(o) != len(e):
  for i in range(len(e)):
    x.append(o[i]+e[i])
  x.append(a[-1])
print(*x,sep="")
    

### FIXED CODE ###

o = str(input())
e = str(input())
x = []
if len(o) == len(e):
  for i in range(len(o)):
    x.append(o[i]+e[i])
else:
  for i in range(len(e)):
    x.append(o[i]+e[i])
  x.append(o[-1])
print(*x,sep="")
#!usr/bin/env python3
from collections import defaultdict
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
mod = 1000000007

#A
"""
x = I()
if x < 1200:
    print("ABC")
else:
    print("ARC")
"""
#B
s = S()
n = len(s)
for i in range(n):
    if s[i] == "A":
        for j in range(i+1,n):
            s[j] == "Z":
                print(j-i+1)
                quit()
#C
"""
x = I()
ans = 2*(x//11)+1
x %= 11
if x == 0:
    ans -= 1
if x > 6:
    ans += 1
print(ans)
"""

#D
"""
n = I()
a = LI()
d = defaultdict(int)
for i in a:
    d[i] += 1
l = list(d.values())
k = len(l)+sum(l)
for i in d.keys():
    d[i] = 1
ans = sum(list(d.values()))
ans -= 1 if k%2 else 0
print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict
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
mod = 1000000007

#A
"""
x = I()
if x < 1200:
    print("ABC")
else:
    print("ARC")
"""
#B
s = input()
n = len(s)
for i in range(n):
    if s[i] == "A":
        break
for j in range(n)[::-1]:
    if s[j] == "Z":
        break
print(j-i+1)
#C
"""
x = I()
ans = 2*(x//11)+1
x %= 11
if x == 0:
    ans -= 1
if x > 6:
    ans += 1
print(ans)
"""

#D
"""
n = I()
a = LI()
d = defaultdict(int)
for i in a:
    d[i] += 1
l = list(d.values())
k = len(l)+sum(l)
for i in d.keys():
    d[i] = 1
ans = sum(list(d.values()))
ans -= 1 if k%2 else 0
print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T
n = int(raw_input())
while n != 0:
    input_list = []
    for x in range(n):
        input_list.append(map(int, raw_input().split(' ')))
    last_list_row = []
    for x in range(n):
        input_list[x].append(sum(input_list[x]))
        print ''.join(map(lambda n:"{:>5}".format(n), input_list))
        last_list.append(input_list[x][-1])

    input_len = len(input_list[0])
    column_list = []
    for x in range(input_len):
        tmp = 0
        for y in range(n):
            tmp += input_list[y][x]
        column_list.append(tmp)
    print ''.join(map(lambda n:"{:>5}".format(n), column_list))
    n = int(raw_input())

### FIXED CODE ###

n = int(raw_input())
while n != 0:
    input_list = []
    for x in range(n):
        input_list.append(map(int, raw_input().split(' ')))
    for x in range(n):
        input_list[x].append(sum(input_list[x]))
        print ''.join(map(lambda n:"{:>5}".format(n), input_list[x]))

    input_len = len(input_list[0])
    column_list = []
    for x in range(input_len):
        tmp = 0
        for y in range(n):
            tmp += input_list[y][x]
        column_list.append(tmp)
    print ''.join(map(lambda n:"{:>5}".format(n), column_list))
    n = int(raw_input())
s = input()
print(str(s[0]) + len(s)-2 + str(s[-1]))

### FIXED CODE ###

s = input()
x = len(s)-2
print(s[0] + str(x) + s[-1])
length, width = map(input().split())
print((length-1)*(width-1))

### FIXED CODE ###

length, width = map(int, input().split())
print((length-1)*(width-1))