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