791. Custom Sort String——string
题目分析:S中先出现的T中先出现
class Solution(object): def repeatedNTimes(self, S, T): count = collections.Counter(T) answer = "" for s in S: answer += s*count[s] count[s] = 0 for c in count: answer += c*count[c] return answer
题目分析:S中先出现的T中先出现
class Solution(object): def repeatedNTimes(self, S, T): count = collections.Counter(T) answer = "" for s in S: answer += s*count[s] count[s] = 0 for c in count: answer += c*count[c] return answer