Sort a string by the order it's characters appear in another string.
Anonymous
Create a map of every unique character in the reference string to the index of its first appearance in the reference string. Using this map, convert working string into array of indices. Numerically sort this array of indices. Using the inverse of the aforementioned map, map the array of indices back into an array of characters. Depending on the language, then join the character array back into a string.
Check out your Company Bowl for anonymous work chats.