If the word list ( words
one word) contains license ( licensePlate
) all the letters, then we call it a complete word. In all a complete word, we call it the shortest shortest word complete word.
Not case-sensitive when matching license plate letters, such as the license "P"
can still match the words in the "p"
letter.
We guarantee a minimum there must be a complete word. When there are multiple words match the criteria, the shortest term of a complete list of words to take the most forward.
License may contain the same character more, for example: For the license "PP"
, words "pair"
can not match, but "supper"
can match.
Example 1:
输入:licensePlate = "1s3 PSt", words = ["step", "steps", "stripe", "stepple"]
输出:"steps"
说明:最短完整词应该包括 "s"、"p"、"s" 以及 "t"。对于 "step" 它只包含一个 "s" 所以它不符合条件。同时在匹配过程中我们忽略牌照中的大小写。
Example 2:
输入:licensePlate = "1s3 456", words = ["looks", "pest", "stew", "show"]
输出:"pest"
说明:存在 3 个包含字母 "s" 且有着最短长度的完整词,但我们返回最先出现的完整词。
note:
- Plate
(licensePlate)
length in the region[1, 7]
of. - License
(licensePlate)
will contain numbers, spaces, or letters (uppercase and lowercase). - Word list
(words)
length in the interval[10, 1000]
of. - Each word
words[i]
is lowercase, and the length in the range[1, 15]
of.