Custom Sort String
order has distinct lowercase letters and defines a custom alphabet: a letter that appears earlier in order is smaller. Return the letters of s sorted by this alphabet. Letters of s that are not in order go at the end, in alphabetical order.
Example 1
order "cba"
s "abcd"
returns "cbad"
c, b, a follow order, then the unlisted d: cbad.
Constraints
0 <= len(order) <= 261 <= len(s) <= 50- Lowercase letters only;
orderhas no repeats
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.