codeforces 71A. Way Too Long Words

题目链接:http://codeforces.com/problemset/problem/71/A

题目大意:给出n个单词,每个字母数多于10的都视为过长单词,否则视为短单词,长单词输出格式为第一个字母+单词不算第一个和最后一个字母中间的字母数目+最后一个字母

直接模拟即可,因为多于10才进行变形,所以不用考虑缩写后中间数目为0的情况

#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
	cin>>n;
	while(n--){
		cin>>s;
		if(s.size()>10)
			cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
		else cout<<s<<endl;
	}
	return 0;
}
posted @ 2016-08-03 20:22  Aiky  阅读(353)  评论(0)    收藏  举报