Disclaimer: Make sure you tried enough before checking the solution
Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219856/problem/F
#include<stdio.h> #include<string.h> int main(){ int t; char b[10000]; scanf("%d",&t); while(t--){ scanf("%s",b); if(strlen(b)<=10){ printf("%s\n",b); } else{ printf("%c%d%c\n",b[0],strlen(b)-2,b[strlen(b)-1]); } } return 0; }
Assiut University Training – Newcomers Solution String