← 返回 amazon 的题目列表Minimize String with Insert Operation
类型:online_judge
Given a string s and an operation operation which allows inserting a character (selected from a given character set) at any position to make the string lexicographically smallest, write a function to return the smallest lexicographical string after the operation.
Input
A string s.
A set of allowed characters for insertion operation.
Output
A string, representing the lexicographically smallest string after applying the operation.
Constraints
1 <= len(s) <= 1000
operation contains at least one character
Example
Input
abc
x
Output
axbc
Example
Input
abc
x