Sometimes some words like "localization" or
"internationalization" are so long that writing them many times in
one text is quite tiresome. Let's consider a word too long, if its length is
strictly more than 10 characters. All too long words should be replaced with a
special abbreviation. This abbreviation is made like this: we write down the
first and the last letter of a word and between them we write the number of letters
between the first and the last letters. That number is in decimal system and
doesn't contain any leading zeroes.
Input
Format
The first line contains an integer n (1 ≤ n ≤ 100). Each of the
following n lines contains one word. All the words consist of lowercase Latin
letters.
Constraints
the lengths of from 1 to 100 characters.
Output
Format
Print n lines. The i-th line should contain the result of
replacing of the i-th word from the input data.
Sample
Input 0
2
localization internationalization
Sample
Output 0
l10n
i18n
Solution
n=int(input())
a=list(map(str,input().split()))
for i in a:
if len(i)>=10:
x=list(i.lower())
print(x[0]+str(len(x)-2)+x[len(x)-1])
else:
print(i)

0 Comments