LearnPy Hub
← Arena
IntermediateRating 1100

Sort by a Custom Order

Sort the letters of the word using the order of the letters in the key (letters missing from the key go at the end, alphabetically).

Input

The key, then the word.

Output

One string.

Sample 1

Input
cba
abcd
Output
cbad

Sample 2

Input
bcafg
abcd
Output
bcad
solution.py
Output appears here
Sort by a Custom Order · Python Arena problem · LearnPy Hub