Signs for the Fair
Signs for the Fair
A technology fair in Puerto Rico needs signs containing words. To save space, abbreviate every word longer than ten letters: keep its first and last letters, and write the number of removed letters between them. Words of at most ten letters stay unchanged.
For example, "computadoras" has twelve letters and becomes "c10s".
Input
The first line contains n. Each of the next n lines contains one word using only lowercase letters a through z, with no accents.
Output
Print n lines, one per word, abbreviated or unchanged as appropriate.
Constraints
1 ≤ n ≤ 100; each word contains between 1 and 100 letters.
Execution limits
2 s · 256 MiB
Example 1
Input:
3
casa
computadoras
abcdefghij
Output:
casa
c10s
abcdefghij
The ten-letter word stays unchanged.
Scoring
This problem counts as one solved problem only if all test cases pass. No partial credit is awarded.
Source
Adapted for OiPR 2026. Codeforces 71A — Way Too Long Words.
Comments