Way Too Long Words

简介: Way Too Long Words

文章目录

一、Way Too Long Words

总结


一、Way Too Long Words

本题链接:Way Too Long Words


题目:

A. Way Too Long Words

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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.


Input

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.


Output

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


Examples

input

4

word

localization

internationalization

pneumonoultramicroscopicsilicovolcanoconiosis

output

word

l10n

i18n

p43s


本博客给出本题截图:

image.png

题意:对于小于等于10长度的字符串直接输出,长度大于10的字符串输出首字符和首位字符中间的长度以及尾字符

AC代码

#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n;
  cin >> n;
  while (n -- )
  {
    string a;
    cin >> a;
    if(a.size() <= 10) cout << a << endl;
    else
    {
      cout << a[0] << a.size() - 2 << a[a.size() - 1] << endl;
    }
  }
  return 0;
}

总结

strictly 严格地

abbreviation 缩写

consist由…构成

lowercase 小写字母

latin letters 希腊字母

possess 拥有

水题,不解释


目录
相关文章
|
7月前
|
分布式计算 DataWorks 监控
DataWorks操作报错合集之遇到“OSERROR: argument list too long”的错误,该如何处理
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
67 1
|
8月前
|
Java
Intellij IDEA运行报Command line is too long的解决办法
Intellij IDEA运行报Command line is too long的解决办法
513 1
|
Java
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
207 0
|
8月前
四种解决”Arg list too long”参数列表过长的办法
这些方法都可以帮助你避免因参数列表过长而导致的错误。选择方法取决于具体情况和需求。
323 0
|
Java 开发工具 git
解决Error running XXXApplicationCommand line is too long.报错
解决Error running XXXApplicationCommand line is too long.报错
|
Java Spring
Command line is too long. Shorten command line for Application or also for Spring Boot default confi
Command line is too long. Shorten command line for Application or also for Spring Boot default confi
47 1
|
Java
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
102 0
|
Java
【异常】SpringBoot报错Command line is too long.Shorten command line for Application or also for Applicatio
【异常】SpringBoot报错Command line is too long.Shorten command line for Application or also for Applicatio
900 0
|
机器学习/深度学习
CF71A Way Too Long Words(string简单模拟)
CF71A Way Too Long Words(string简单模拟)
70 0
|
Java
解决Command line is too long. Shorten command line for ServiceStarter or also for Application报错
解决Command line is too long. Shorten command line for ServiceStarter or also for Application报错
385 0