← Questions

Minimal unique word abbreviations

0
AppleCodingLast asked Jun 2026

Given a list of distinct words, give every word the shortest abbreviation that no other word shares. An abbreviation keeps a prefix of the word, then the count of skipped letters, then the last letter; start with a one-letter prefix and grow the prefix for words that collide until they are unique. Keep the full word if the abbreviation would not be shorter.

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