You are given a string licensePlate and an array of strings words.
Your task is to locate the shortest word from the list that fully satisfies the character requirements present in licensePlate.
Only alphabetic characters from licensePlate matter — digits, symbols, and spaces should be ignored.
Letter matching is case-insensitive.
If a letter appears multiple times in licensePlate, the chosen word must include that letter at least the same number of times.
Among all valid words, return the shortest one.
If several words share the same length, return the one that appears earliest in the list.
Input: licensePlate = "Rt 22 r" words = ["tiger", "truer", "rtr", "rabbit"]
Output: "rtr"
Explanation:
licensePlate contains: r(2), t(1). Valid words: "truer" (has r3, t1), "rtr" (has r2, t1). Shortest valid = "rtr".
Input: licensePlate = "A7cB" words = ["abacus", "back", "cab", "grab"]
Output: "cab"
Explanation:
Required letters → a, b, c (case-insensitive) Valid: "abacus", "back", "cab" Shortest is "cab".
Accepted:
Submission: