CF71A.Way Too Long Words

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

有时候,一些单词(例如 “localization” 或 “internationalization”)太长了,以至于在一段文字中多次书写它们会非常繁琐。

我们定义一个单词“过长”,当且仅当它的长度严格大于 10 个字符。所有过长的单词都应被替换为一种特殊缩写。

该缩写的构造方式如下:写出该单词的首字母和尾字母,在二者之间写上首尾字母之间的字母个数。该数字采用十进制表示,且不含前导零。

因此,“localization” 将缩写为 “l10n”,而 “internationalization” 将缩写为 “i18n”。

你需要将这一缩写过程自动化:所有过长的单词均需被其对应缩写替换,而非过长的单词则保持不变。

输入格式

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 and possess the lengths of from 1 to 100 characters.

第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)。接下来的 nn 行,每行包含一个单词。所有单词均由小写拉丁字母组成,且长度在 11 到 100100 个字符之间。

输出格式

Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

输出 n 行。第 i 行应包含将输入数据中第 i 个单词替换后得到的结果。

输入输出样例

  • 输入#1

    4
    word
    localization
    internationalization
    pneumonoultramicroscopicsilicovolcanoconiosis

    输出#1

    word
    l10n
    i18n
    p43s

输入解题思路,AI测评打分。不知道怎么写?

首页