include <stdio.h>
include <malloc.h>
include <string.h>
int main() { int n, i, j; char st[100][101]; char sc[][2]={"0","1","2","3","4","5","6","7","8","9"}; scanf("%d",&n); for(i=0;i<=n;i++) { fflush(stdin); gets(st[i]); } for(i=0;i<=n;i++) { char sm[5]="\0"; if(strlen(st[i]) > 10) { j = strlen(st[i]) — 2; if(j==9) { sm[0] = st[i][0]; sm[1] = sc[9][0]; sm[2] = st[i][strlen(st[i])-1]; sm[3] = '\0'; printf("%s\n",sm); } else { int k = j%10; j=j/10; sm[0] = st[i][0]; sm[1] = sc[j][0]; sm[2] = sc[k][0]; sm[3] = st[i][strlen(st[i])-1]; sm[4] = '\0'; printf("%s\n",sm); } } else printf("%s\n",st[i]); } return 0; }




