Page tree
Skip to end of metadata
Go to start of metadata

티셔츠 소트

T sort
from collections import defaultdict

def size_sort(shirts):
    d = defaultdict(int)
    for shirt_size in shirts:
        d[shirt_size] += 1
        
    result = ''
    for shirt_size in ['S', 'M', 'L']:
        if shirt_size in d.keys():
            result += d[shirt_size] * shirt_size
        
    return(result)
    
size_sort("MSSS")
  • No labels