我是靠谱客的博主 坚强月亮,这篇文章主要介绍codeforces71A,现在分享给大家,希望可以做个参考。

Way Too Long Words

 CodeForces - 71A 

XUPT_ACM的杨队是一个强迫症晚期的大神,他特别反感长单词,就像 "localization" 和"internationalization" 。

于是睿智的杨队想出了一个方法来节约写单词的时间, 如果单词的长度严格大于10个字符,那么他可以用以下方法表示:

写下这个单词的第一个字母与最后一个字母,在它们之间写下除去第一个字母和最后一个字母后该单词包含的字母个数,这个数字是不包含前导零的十进制数字。

举个栗子, "localization" 可以表示为"l10n", "internationalization"可以被表示为"i18n".

你的任务是通过编写代码实现这样一个转化的过程,太长的单词通过上述方法表示,其他的单词保持不变

Input

第一行包含一个整数n (1 ≤ n ≤ 100). 接下来n行每行包含一个单词. 所有的单词由小写字母组成,单词的长度为1 到100个字符.

Output

输出 n 行. 第 i 行包括第 i 个单词的转化结果.

Examples

Input
复制代码
1
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
Output
复制代码
1
word
l10n
i18n
p43s

sol:直接按题意模拟就可以了
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h> using namespace std; typedef int ll; inline ll read() { ll s=0; bool f=0; char ch=' '; while(!isdigit(ch)) { f|=(ch=='-'); ch=getchar(); } while(isdigit(ch)) { s=(s<<3)+(s<<1)+(ch^48); ch=getchar(); } return (f)?(-s):(s); } #define R(x) x=read() inline void write(ll x) { if(x<0) { putchar('-'); x=-x; } if(x<10) { putchar(x+'0'); return; } write(x/10); putchar((x%10)+'0'); return; } #define W(x) write(x),putchar(' ') #define Wl(x) write(x),putchar('n') const int N=105; char S[N]; int main() { int T; R(T); while(T--) { scanf("%s",S+1); int Len=strlen(S+1); if(Len<=10) printf("%sn",S+1); else { putchar(S[1]); write(Len-2); putchar(S[Len]); putchar('n'); } } return 0; }
View Code

 

复制代码
1
 

转载于:https://www.cnblogs.com/gaojunonly1/p/10574953.html

最后

以上就是坚强月亮最近收集整理的关于codeforces71A的全部内容,更多相关codeforces71A内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部