http://codeforces.com/contest/71
A
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define eps 1e-8 10 #define pi acos(-1.0) 11 #define rep(k,i,j) for(int k=i;k<j;k++) 12 typedef long long ll; 13 typedef unsigned long long ull; 14 15 int main(){ 16 #ifndef ONLINE_JUDGE 17 // freopen("input.txt","r",stdin); 18 #endif 19 std::ios::sync_with_stdio(false); 20 int n; 21 string str; 22 cin>>n; 23 rep(i,0,n){ 24 cin>>str; 25 if(str.length()<=10){ 26 cout<<str<<endl; 27 } 28 else{ 29 cout<<str[0]; 30 cout<<str.length()-2; 31 cout<<str[str.length()-1]<<endl; 32 } 33 } 34 }