Tags » string processing
TIL: Find the shortest prefix to identify a string in Ruby
The built-in
Abbrevmodule can calculate a set of unambiguous abbreviations for a set of strings, and then you can look for the shortest result for each string.
The built-in Abbrev module can calculate a set of unambiguous abbreviations for a set of strings, and then you can look for the shortest result for each string.