Harryxun/stf_run huggingface dataset:
def calcMax(i):
  now = numbers[i] 

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

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

m = -1000000001
for i in range(len(numbers) - 1):
    if i == 0 or i == len(numbers) - 1 or (numbers[i-1] >= numbers[i] and numbers[i] =< numbers[i+1]):
      temp = calcMax(i)
      #print("temp: " + str(temp))
      if temp > m:
          m = temp

print (m)



### FIXED CODE ###

def calcMax(i):
  now = numbers[i]

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

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

m = -1000000001
ti = 1000000001
for i in range(len(numbers) - 1):
    if numbers[i] < ti:
      if (i == 0 or i == len(numbers) - 1 or (numbers[i-1] >= numbers[i] and numbers[i] <= numbers[i+1])):
        temp = calcMax(i)
        #print("temp: " + str(temp))
        if temp > m:
            m = temp
            ti = numbers[i]

print (m)
import queue
H,W = map(int,input().split())
maze = list()
q = queue.Queue()
for i in range(H):
   maze.append( [x for x in input()])

maxim = 1
for i in range(H):
    for j in range(W):
        if maze[i][j] == "." :
            maze_score = [[0]*W for k in range(W)]
            maze_score[i][j] = 1
            q.put([i,j])
            
        else :
            continue
        
        while(True):
            if q.empty() :
                if maze_score[x][y] > maxim:
                    maxim = maze_score[x][y]
                break
            [x,y] = q.get()
            
            
            
            
            ##top
            if x != 0:
                if (maze_score[x-1][y] ==0 or maze_score[x-1][y] > maze_score[x][y]+1) and maze[x-1][y] == ".":
                    maze_score[x-1][y] = maze_score[x][y] +1
                    q.put([x-1,y])
            ##right
            if y != W-1:
                if (maze_score[x][y+1] ==0 or maze_score[x][y+1] > maze_score[x][y]+1) and maze[x][y+1] == ".":
                    maze_score[x][y+1] = maze_score[x][y] +1
                    q.put([x,y+1])
            ##bottom
            if x != H-1:
                if (maze_score[x+1][y] ==0 or maze_score[x+1][y] > maze_score[x][y]+1) and maze[x+1][y] == ".":
                    maze_score[x+1][y] = maze_score[x][y] +1
                    q.put([x+1,y])
            ##left
            if y != 0:
                if (maze_score[x][y-1] ==0 or maze_score[x][y-1] > maze_score[x][y]+1) and maze[x][y-1] == ".":
                    maze_score[x][y-1] = maze_score[x][y] +1
                    q.put([x,y-1])
        
print(maxim-1)


### FIXED CODE ###

import queue
H,W = map(int,input().split())
maze = list()
q = queue.Queue()
for i in range(H):
   maze.append( [x for x in input()])

maxim = 1
for i in range(H):
    for j in range(W):
        if maze[i][j] == "." :
            maze_score = [[0]*W for k in range(H)]
            maze_score[i][j] = 1
            q.put([i,j])
            
        else :
            continue
        
        while(True):
            if q.empty() :
                if maze_score[x][y] > maxim:
                    maxim = maze_score[x][y]
                break
            [x,y] = q.get()
            
            
            
            
            ##top
            if x != 0:
                if maze_score[x-1][y] ==0 and maze[x-1][y] == ".":
                    maze_score[x-1][y] = maze_score[x][y] +1
                    q.put([x-1,y])
            ##right
            if y+1 != W:
                if maze_score[x][y+1] ==0 and maze[x][y+1] == ".":
                    maze_score[x][y+1] = maze_score[x][y] +1
                    q.put([x,y+1])
            ##bottom
            if x != H-1:
                if maze_score[x+1][y] ==0 and maze[x+1][y] == ".":
                    maze_score[x+1][y] = maze_score[x][y] +1
                    q.put([x+1,y])
            ##left
            if y != 0:
                if maze_score[x][y-1] ==0 and maze[x][y-1] == ".":
                    maze_score[x][y-1] = maze_score[x][y] +1
                    q.put([x,y-1])
        
print(maxim-1)
N, M = map(int, input().split(" "))

if N == 1 and M == 1:
    print(1)

else if N == 1:
    print(M - 2)

else if M == 1:
    print(N - 2)

else:
    print((M - 2)*(N -2))


### FIXED CODE ###

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

print(abs((N - 2) * (M - 2)))
def d(n):
 if n==0:return 0
 return d(n%bin(n).count("1"))+1
n=int(input())
x=input()
c=x.count("1")
a=int(x,2)
j,k=a%(c+1),a%(c-1)
for i in range(n):
 if x[i]=="1":print(d(k-pow(2,n-i-1,c-1)%(c-1))+1)
 else:print(d(j+pow(2,n-i-1,c+1)%(c+1))+1)

### FIXED CODE ###

def dfs(n):
    if n == 0:return 0
    return dfs(n % format(n, "b").count("1")) + 1
n = int(input())
x = input()
c = x.count("1")
a = int(x, 2)
if c == 1:
    for i in range(n):
        if x[i] == "1":
            print(0)
        elif i == n - 1:
            print(2)
        else:
            print(1)
else:
    j, k = a % (c + 1), a % (c - 1)
    for i in range(n):
        if x[i] == "1":print(dfs((k - pow(2, n - i - 1, c - 1)) % (c - 1)) + 1)
        else:print(dfs((j + pow(2, n - i - 1, c + 1)) % (c + 1)) + 1)
n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
def prod(n):
  result = 1
  for x in n:
    result *= x
  return result
  
a = prime_factorize(n)
b = [a.pop(-1)]


while prod(a) > prod(b):
  prev_result = prod(a) + prod(b)
  b.append(a.pop(a.min()))


try:
  if prev_result < prod(a) + prod(b):
    a.append(b.pop(b.min()))


except:
  pass
print(prod(a)-1 +prod(b)-1)



### FIXED CODE ###

n = int(input())

ans = 1e18
for i in range(1, n):
	if i**2 > n:
		break
	if (n%i)== 0:
		j = n/i
		ans = int(min(ans, i+j-2))
print(ans)
n = int(input())
dp = [[[0, -1]] * 3 for _ in range(n)]
abc = [list(map(int, input().split())) for _ in range(n)]
abc = [*zip(*abc)]
a = [*abc[0]]
b = [*abc[1]]
c = [*abc[2]]
dp[0] = [[a[0], 0], [b[0], 1], [c[0], 2]]

for i in range(1, n):
    for j in range(3):
        if dp[i - 1][j][1] == 0:
            for k in [1, 2]:
                t = (b[i] if k == 1 else c[i])
                if dp[i - 1][j][0] + t > dp[i][j][0]:
                    dp[i][j] = [dp[i - 1][j][0] + t, k]
        elif dp[i - 1][j][1] == 1:
            for k in [2, 0]:
                t = (c[i] if k == 2 else a[i])
                if dp[i - 1][j][0] + t > dp[i][j][0]:
                    dp[i][j] = [dp[i - 1][j][0] + t, k]
        else:
            for k in [0, 1]:
                t = (b[i] if k == 1 else a[i])
                if dp[i - 1][j][0] + t > dp[i][j][0]:
                    dp[i][j] = [dp[i - 1][j][0] + t, k]


print(max([i[0] for i in dp[-1]]))


### FIXED CODE ###

n = int(input())
ans = [0] * 3

for i in range(n):
    t1 = list(map(int, input().split()))
    t2 = [0] * 3
    for i in range(3):
        for j in range(3):
            if i != j:
                t2[j] = max(t2[j], ans[i] + t1[j])
    ans = t2
print(max(ans))
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(1,N):
 i = input()
 list.append(i)
 
#リストの結合
mojiretu = ''.join(list)
 
print(mojiretu

### FIXED CODE ###

N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(N):
 i = str(input())
 list.append(i)

#リストのソート
list_a = sorted(list)
 
#リストの結合
mojiretu = ''.join(list_a)
 
print(mojiretu)
from sympy import factorint

N, P = map(int, input().split())
f = factorint(P)

ans = 1
for k, v in f.items():
    if v >= N:
        ans *= k * (v//N)
print(ans)


### FIXED CODE ###

from collections import Counter

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N, P = map(int, input().split())
f = Counter(prime_factorize(P))

ans = 1
for k, v in f.items():
    if v >= N:
        ans *= k ** (v//N)
print(ans)
from functools import lru_cache

N = int(input())
X = input()


@lru_cache(maxsize=None)
def popcount(x):
    return x % bin(x).count('1')


def f(x):
    cnt = 1
    while x > 0:
        x = popcount(x)
        cnt += 1

    return cnt


count = X.count('1')
mod_one = count - 1
mod_zero = count + 1
ones = [1 % mod_one]
zeros = [1 % mod_zero]
x_mod_one = 0 if X[-1] == '0' else 1 % mod_one
x_mod_zero = 0 if X[-1] == '0' else 1 % mod_zero

for xi in reversed(X[:-1]):
    ones.append(ones[-1] * 2 % mod_one)
    zeros.append(zeros[-1] * 2 % mod_zero)
    if xi == '1':
        x_mod_one += ones[-1]
        x_mod_one %= mod_one
        x_mod_zero += zeros[-1]
        x_mod_zero %= mod_zero

ones = list(reversed(ones))
zeros = list(reversed(zeros))

for i in range(N):
    if count == 1 and X[i] == '1':
        print(0)
    elif X[i] == '1':
        x = (x_mod_one - ones[i]) % mod_one
        print(f(x))
    else:
        x = (x_mod_zero + zeros[i]) % mod_zero
        print(f(x))


### FIXED CODE ###

from functools import lru_cache

N = int(input())
X = input()


@lru_cache(maxsize=None)
def popcount(x):
    return x % bin(x).count('1')


def f(x):
    cnt = 1
    while x > 0:
        x = popcount(x)
        cnt += 1

    return cnt


count = X.count('1')
mod_one = count - 1
if mod_one == 0:
    mod_one = 1
mod_zero = count + 1
ones = [1 % mod_one]
zeros = [1 % mod_zero]
x_mod_one = 0 if X[-1] == '0' else 1 % mod_one
x_mod_zero = 0 if X[-1] == '0' else 1 % mod_zero

for xi in reversed(X[:-1]):
    ones.append(ones[-1] * 2 % mod_one)
    zeros.append(zeros[-1] * 2 % mod_zero)
    if xi == '1':
        x_mod_one += ones[-1]
        x_mod_one %= mod_one
        x_mod_zero += zeros[-1]
        x_mod_zero %= mod_zero

ones = list(reversed(ones))
zeros = list(reversed(zeros))

for i in range(N):
    if count == 1 and X[i] == '1':
        print(0)
    elif X[i] == '1':
        x = (x_mod_one - ones[i]) % mod_one
        print(f(x))
    else:
        x = (x_mod_zero + zeros[i]) % mod_zero
        print(f(x))
def sunukeaho(a, b, c, d, e):
	input("番号を入力しろ")
    if a==o:
    	print(1)
	elif b==o:
    	print(1)
	elif c==o:
    	print(1)
	elif d==o:
    	print(1)
    elif e==o:
    	print(1)
   
  
  

### FIXED CODE ###

a,b,c,d,e=(int(x) for x in input().split())
if a==0:
  print(1)
elif b==0:
  print(2)
elif c==0:
  print(3)
elif d==0:
  print(4)
elif e==0:
  print(5)
import copy

s = input()
l1 = len(s)

for i in range(n):
    if '01' in s:
        s = s.replace('01', '')
    elif '10' in s:
        s = s.replace('10', '')
    else:
        break
        
print(l1 - len(s))

### FIXED CODE ###

s = input()
cnt = [s.count('0'), s.count('1')]

print(len(s) - (max(cnt) - min(cnt)))
import math
x=int(input())
l=0
a=[i for i in range(2,x)]
prime=[]
limit=math.sqrt(x)
while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
co=0
x-=1
l=len(prime)
while co==0:
    c=0
    x+=1
    for i in range(l):
        if x%prime[i]!=0:
            c+=1
        else:
            break
    if c==l:
        print(x)
        co+=1

### FIXED CODE ###

import math
x=int(input())
if x==2:
    print(2)
else:   
    l=0
    a=[i for i in range(2,x)]
    prime=[]
    limit=math.sqrt(x)
    while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
    co=0
    x-=1
    l=len(prime)
    while co==0:
        c=0
        x+=1
        for i in range(l):
            if x%prime[i]!=0:
                c+=1
            else:
                break
        if c==l:
            print(x)
            co+=1
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = [int(i) for i in input().split()]
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()
 
out = sum(ys[0:-(int(n)-1)])
print(out)

### FIXED CODE ###

# - coding : utf-8 -*-
 
n, m = list(map(int, input().split()))
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()

for i in range(n - 1):
    if ys == []:
        break
    else:
        ys.pop()
print(sum(ys))
n,a,b=map(int,input().split());k=10**9+7;c=(1<<n)%k-1;X=Y=1
for i in range(b):X=X*(n-i)%k;Y=Y*(i+1)%k;c-=X*pow(Y,k-2,k)if i+1in(a,b)else 0
print(c%k)

### FIXED CODE ###

n,r=map(int,input().split());print(r+max(0,1000-100*n))
#import sys
#input=sys.stdin.readline
N,W=map(int,input().split())
w,v=[0]*N,[0]*N

for i in range(N):
    w[i],v[i]=map(int,input().split())
V=sum(v)
dp=[[float('inf')*(V+1)] for i in range(N+1)] #初期化はfor より *の方が早い

dp[0][0]=0
for i in range(N):
    for j in range(V+1):
        if j-v[i]>=0:
            dp[i+1][j]=dp[i][j-v[i]]+w[i]
        dp[i+1][j]=min(dp[i][j],dp[i+1][j])

for j in range(V+1):
    if dp[N][j]<=W:
        res=j
print(res)
# stdinなし

### FIXED CODE ###

N,W=map(int,input().split())
w,v=[0]*N,[0]*N

for i in range(N):
    w[i],v[i]=map(int,input().split())
V=sum(v)
dp=[[float('inf') for i in range(V+1)] for j in range(N+1)]

dp[0][0]=0
for i in range(N):
    for j in range(V+1):
        if j-v[i]>=0:
            dp[i+1][j]=dp[i][j-v[i]]+w[i]
        dp[i+1][j]=min(dp[i][j],dp[i+1][j])

for j in range(V+1):
    if dp[N][j]<=W:
        res=j
print(res)
x,y = map(int,input().split())
	if x*y%2==0:
    	print("Even")
    elif :
      print("Odd")





### FIXED CODE ###

a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest094 e問題 未完成
Author     : Kitaura Hiromi
LastUpdate : 20180420
Since      : 20180414
"""

# 最終的に, 1組以外はすべて0になる

N = int(input())
queA = []
queB = []
for i in range(N):
    A, B = map(int, input().split(" "))
    queA.append(A)
    queB.append(B)

cnt = 0
if np.allclose(queA, queB):
    print(cnt)
    return 0
else:
    tmp = []
    for i, B in enumerate(queB):
        if queA[i] > B:
            tmp.append(B)
    print(sum(queA) - min(tmp))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest094 e問題 未完成
Author     : Kitaura Hiromi
LastUpdate : 20180420
Since      : 20180414
"""
inf = 10**20
# 最終的に, 1組以外はすべて0になる
N = int(input())
s = 0
m = inf
for i in range(N):
    a, b = map(int, input().split(" "))
    if a > b:
        if m > b:
            m = b
    s += a
if m == inf:
    print(0)
else:
    print(s - m)
N, K = map(int, input().split())
ans = 0
while True:
    ans = ans + 1
    N = N / K
    if N < K:
        print(ans + 1)
        return

### FIXED CODE ###

N, K = map(int, input().split())
ans = 0
while True:
    if N < K:
        print(ans + 1)
        break
    ans = ans + 1
    N = N / K
import math

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

i = 1
num = 1
while (x - b*i) / a >= num:
	i += 1
	num *= 10

i -= 1
num //= 10
hikaku = (x - b*i) / a
#hikaku = min(hikaku,10**i-1)

if i > 9:
	print(1000000000)
elif i == 0:
	print(0)
else:
	#print(math.floor(hikaku))
	for n in range(math.floor(hikaku)-2,num*10):
		if a * n + b * i >= x:
			break
	print(n-1)


### FIXED CODE ###

s = input()

if s == 'SUN':
	print(7)
elif s == 'MON':
	print(6)
elif s == 'TUE':
	print(5)
elif s == 'WED':
	print(4)
elif s == 'THU':
	print(3)
elif s == 'FRI':
	print(2)
elif s == 'SAT':
	print(1)
else:
	print(0)
import sys
x=raw_input()
for abc in sys.stdin:
    L=map(int,abc.split(" ")).sort()
    if L[0]**2 + L[1]**2 == L[2]**2:
        print "YES"
    else:
        print "NO"

### FIXED CODE ###

for i in range(input()):
    x=raw_input()
    L=map(int,x.split(" "))
    L.sort()
    if L[0]**2 + L[1]**2 == L[2]**2:
        print "YES"
    else:
        print "NO"
n = list(map(int, input()))
if len(n) == 6:
        print(90909)
elif len(n) == 5:
        num = n[0] * 10000 + n[1] * 1000 + n[2] * 100 + n[3] * 10 + n[4]
        ptint((num - 10000) + 1 + 900 + 9)
elif len(n) == 4:
        num = n[0] * 1000 + n[1] * 100 + n[2] * 10 + n[3] * 1
        print(909)
elif len(n) == 3:
        num = n[0] * 100 + n[1] * 10 + n[2] * 1
        print((num - 100) + 1 + 9)
elif len(n) == 2:
        num = n[0] * 10 + n[1] * 1
        print(9)
else:
        print(n)

### FIXED CODE ###

n = list(map(int, input()))
if len(n) == 6:
        print(90909)
elif len(n) == 5:
        num = n[0] * 10000 + n[1] * 1000 + n[2] * 100 + n[3] * 10 + n[4]
        print((num - 10000) + 1 + 900 + 9)
elif len(n) == 4:
        print(909)
elif len(n) == 3:
        num = n[0] * 100 + n[1] * 10 + n[2] * 1
        print((num - 100) + 1 + 9)
elif len(n) == 2:
        print(9)
else:
        num=n[0]*1
        print(num)
import math
from functools import reduce

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

for i in range(len(arr)):
    arr[i] -= X
    
df = []
for i in range(1, len(arr)):
    df.append(arr[i] - arr[i-1])

if(N == 1):
    df.append(arr[0])

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

print(gcd_list(df))

### FIXED CODE ###

import fractions
from functools import reduce

n, x = map(int,input().split())
a = list(map(int,input().split()))

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(fractions.gcd, a))
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)

if (list[list%2 == 0]==list[list%6 == 0 or list%10 == 0]) :
    print('APPROVED')
else:
    print('DENIED')


### FIXED CODE ###

import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = np.unique(list[list%2 == 0])
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')
import numpy as np
h,w,m = map(int,input().split())
bomb = list(tuple(map(lambda x: int(x)-1,input().split())) for i in range(m))
Map= np.zeros((h,w))
for i in bomb:
    Map[i] = 1
bombx = np.count_nonzero(Map,axis=1)
bomby = np.count_nonzero(Map,axis=0)
maxx = max(bombx)
maxy = max(bomby)
maxx_index = np.where(bombx == maxx)
maxy_index = np.where(bomby == maxy)
flag = 0
for i in maxx_index[0]:
    for j in maxy_index[0]:
        if Map[i][j] == 0:
            flag = 1
if flag == 0:
    print(maxx+maxy-1)
else:
    print(maxx+maxy)

### FIXED CODE ###

h,w,m = map(int,input().split())
bombX = [0]*h
bombY = [0]*w
bomb = set()
maxX = maxY = 0
for i in range(m):
    i,j = map(lambda x:int(x)-1, input().split())
    bomb.add((i,j))
    bombX[i] += 1
    bombY[j] += 1
    maxX = max(maxX,bombX[i])
    maxY = max(maxY,bombY[j])
maxX_index = list(i for i in range(h) if bombX[i] == maxX)
maxY_index = list(i for i in range(w) if bombY[i] == maxY)
for i in maxX_index:
    for j in maxY_index:
        if (i,j) in bomb: continue
        print(maxX+maxY)
        exit()
print(maxX+maxY-1)
N=input()
alist = list(map(int,input().split()))

ans = 0
for i in range(N):
  ans += abs(alist[i])
  
print(ans)

### FIXED CODE ###

N = int(input())
alist = list(map(int,input().split()))

neg_cnt = 0
abs_min = 999999999999999
for an in alist:
  if an < 0:
    neg_cnt += 1
  if abs_min > abs(an):
    abs_min = abs(an)
 
ans = 0
for i in range(N):
  ans += abs(alist[i])
  
if neg_cnt%2 == 0:
  print(ans)
else:
  print(ans-2*abs_min)
n = int(input())
l = [list(list(input())) for _ in range(n)]
for i in range(n):
    l[i].sort()

x = []
for i in range(len(l[0])):
    if l[0][i] == l[1][i] == l[2][i]:
        x.append(l[1][i])
print(*sorted(x))

### FIXED CODE ###

n = int(input())
l = [list(list(input())) for _ in range(n)]

l = sorted(l, key = len)

x = []
for i in range(len(l[0])):
    y = 0
    for j in range(n):
        if l[0][i] in l[j]:
            y +=1
            if y == n:
                x.append(l[0][i])
                for k in range(1, n):
                    l[k].remove(l[0][i])

print(''.join(sorted(x)))
admission = []
n = int(input())
admission.append(map(int,input().split()))

for i in range(n):
    if admission[n-1] % 2 == 0:
        if admission[n-1] % 3 == 0 or admission[n-1] % 5 == 0:
            print("APPROVED")
        else:
            print("DENIED")

### FIXED CODE ###

n = int(input())
a = map(int,input().split())
for l in a:
    if l % 2 ==0:
        if l % 3 == 0 or l % 5 == 0:
            continue
        else:
            print("DENIED")
            quit()
print("APPROVED")
a=input()
print('{}{}{}'.format(a[0],str(len(a)-2),a[-1])

### FIXED CODE ###

a=input()
print('{}{}{}'.format(a[0],str(len(a)-2),a[-1]))
#C - Day dream
S_input = input()
S = S_input
for i in range(len(S_input)):
    S = S[:i]+S_input[len(S_input)-1-i]+S[i+1:]
#print(S)
#S_input = input()
    
#S = S_input[::-1]
end_flg = 1
while end_flg:
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.reaplace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end_flg = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

#C - Day dream
S_input = input()
S = S_input
for i in range(len(S_input)):
    S = S[:i]+S_input[len(S_input)-1-i]+S[i+1:]
#print(S)
#S_input = input()
    
#S = S_input[::-1]
end_flg = 1
while end_flg:
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.replace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end_flg = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')
N = int(input())
X = input()
M = {X[0:3]:1}
result = {}

for i in range(3,N):
    i = X[i]
    keys = M.keys()
    for j in tuple(keys):
        if (j, i) in result:
            continue
        M[j[0]+j[1]+i] = 1
        M[j[0]+j[2]+i] = 1
        M[j[1]+j[2]+i] = 1
        result[(j,i)] = True

print (len(M))

### FIXED CODE ###

M1, D1 = [int(_) for _ in input().split(" ")]
M2, D2 = [int(_) for _ in input().split(" ")]
if M1 == M2:
    print (0)
else:
    print (1)
a,b,c=map(int,input())

if a==b and b== c and a== c:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a,b,c=map(int,input().split())

if a==b and b==c and a==c:
  print('No')

elif a!=b and a!= c and b!= c:
    print('No')
else:
  print('Yes')
n = list(map(int, input().split()))
N = n[0]
K = n[1]

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

num = [i for i in range(1,10)]
for i in d:
  if i == 0:
    continue
  else:
    num.remove(i)

total = N*min(num)
if total > N:
  print(N)
else:
  print(total)

### FIXED CODE ###

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

i = sum(n)

if i % 17 == 0:
    print('YES')
else:
    print('NO')
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif):
    print(s + dif[0])
else:
    if reversed(alphabet) == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                dif = sorted(list(set(alphabet) - set(s[:i])))
                tmp.append(s[:i-1] + dif[0])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

### FIXED CODE ###

s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)