fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int num, len;
  9. string w, wl, temp;
  10. cin>>num;
  11.  
  12. for(int x = 0; x <num; x++){
  13.  
  14. cin>>w;
  15. len = w.length();
  16. if (len < 10)
  17. cout << w << endl;
  18. else
  19. {
  20. temp = w[0];
  21. wl += temp;
  22. temp = to_string(len - 2);
  23. wl += temp;
  24. temp = w[len - 1];
  25. wl += temp;
  26. cout << wl << endl;
  27. wl = "";
  28. }
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
stdout
word
l10n
i18n
p43s