← 返回 bloomberg 的题目列表Sort Words by Custom Alphabet Order
类型:online_judge
Given a string order which represents a custom letter ordering, and a list of words, sort the words according to this custom order.
Input: A string order and a list of words.
Output: A list of words sorted according to order.
Example:
Input:
order = "cba"
words = ["abc", "acb", "bac", "cab", "bca"]
Output: ["cab", "bac", "bca", "acb", "abc"]
Example
Input
"cba" ["abc", "acb", "bac", "cab", "bca"]