Way Too Long Words
Practice this coding question on Coding Gurukul.
Problem statement
A compact display shortens words longer than ten characters. Keep the first and last characters and replace everything between them with its character count. Leave shorter words unchanged. Process each supplied word independently.
Input format
First line: n. Next n lines: one lowercase word each.
Output format
Print one transformed word per line.
Constraints
1 <= n <= 100; 1 <= word length <= 100.
Sample input
3 algorithm abcdefghijkl platform
Sample output
algorithm a10l platform
Sign in to run or submit a solution in C++, Java or Python.