美文网首页
423. Reconstruct Original Digits

423. Reconstruct Original Digits

作者: 阿团相信梦想都能实现 | 来源:发表于2016-12-18 06:37 被阅读0次
class Solution(object):
    def originalDigits(self, s):
        """
        :type s: str
        :rtype: str
        """
        
        a=collections.Counter(letter for letter in s)
        return '0'*a['z']+'1'*(a['o']-a['z']-a['w']-a['u'])+'2'*a['w']+'3'*(a['h']-a['g'])+'4'*a['u']+'5'*(a['f']-a['u'])+'6'*a['x']+'7'*(a['s']-a['x'])+'8'*a['g']+'9'*(a['i']-a['g']-a['x']-a['f']+a['u'])
        
            

相关文章

网友评论

      本文标题:423. Reconstruct Original Digits

      本文链接:https://www.haomeiwen.com/subject/pcmamttx.html