You receive two strings: order and s. The string order is a permutation of some lowercase letters that defines a custom ordering. Rearrange the characters of s so they follow the order given by order. Characters not in order can go anywhere. Meta interviews include this to test custom comparator logic and counting-based approaches.
For example, if order = "cba" and s = "abcd", one valid output is "cbad".
How can you rearrange s without a full comparison sort? Think about counting.
Constraints: order, s.