Shorten very long words by replacing the middle with the count of removed characters.
You are given a list of words. For each word, if its length is greater than 10, replace it with a shortened form consisting of its first letter, the number of omitted middle characters, and its last letter. Otherwise, keep the word unchanged.
For example, localization becomes l10n because 10 characters are removed from the middle.
Return the transformed words in the same order.
For each word:
len(word) <= 10, output the word as-is;(len(word) - 2) + last character.Print lines. Each line should contain the transformed version of the corresponding input word.
Example 1
Input
4 word localization internationalization it
Output
word l10n i18n it
Explanation
Only words longer than 10 characters are abbreviated. Short words stay unchanged.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.