您的位置:首页 > 其它

CodeForces 71 A.Way Too Long Words(水~)

2017-09-01 22:45 387 查看
Description

给出一个字符串,串长不超过10则直接输出,如果超过10就只输出首字母+中间字符个数+尾字母

Input

第一行一整数T表示用例组数,每组用例输入一个字符串s(1≤T,|s|≤100)

Output

输出处理后的字符串

Sample Input

4

word

localization

internationalization

pneumonoultramicroscopicsilicovolcanoconiosis

Sample Output

word

l10n

i18n

p43s

Solution

水题

Code

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f,maxn=100001;
char s[maxn];
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%s",s);
int len=strlen(s);
if(len<=10)printf("%s\n",s);
else printf("%c%d%c\n",s[0],len-2,s[len-1]);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: