https://leetcode.com/problems/custom-sort-string/
class Solution {
public:
string customSortString(string S, string T) {
string res = "";
map<char, int>mp;
for(auto c: T) mp[c]+=1;
for(auto c: S){
res += string(mp[c], c); //mp[c]个 c
mp[c] = 0;
}
for(auto a:mp){
res += string(a.second, a.first);
}
return res;
}
};