← Questions

Shortest unique abbreviation for every word

0
MetaCodingLast asked Feb 2026

Abbreviate each word in a list of distinct words as a prefix, the count of the letters in between, and the last letter (like becomes l2e). When two words share an abbreviation, lengthen their prefixes until every abbreviation is unique, and keep a word whole if abbreviating does not make it shorter. Return the abbreviations in input order.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding