You are given two strings: order and s.
All characters of order are unique and define a custom ordering of lowercase letters.
Rearrange the characters of s so that they match the ordering defined by order. Specifically:
order should be sorted according to their position in orderorder should be placed at the end of the result, in their original relative order from sReturn the rearranged string.
order = "cba", s = "abcd""cbad"order = "bcafg", s = "abcd""bcad"order = "xyz", s = "hello""hello"1 <= order.length <= 261 <= s.length <= 200order and s consist of lowercase English lettersAll characters in order are uniqueRun your code to see results
Use Cmd+Enter to run