you give string order s all character order unique sorted custom order previouslypermute character s match order order sort more specifically character x occur character y order x occur y permute stringreturn permutation s satisfie property Example 1input order cba s abcdOutput cbadExplanation b c appear order order b c c b since d appear order position return string dcba cdba cbda valid outputsexample 2input order cbafg s abcdoutput cbad Constraints1 orderlength 261 slength 200order s consist lowercase English lettersall character order unique