[プログラマーLV 2]コレクション辞書


1.問題の説明
アクセント辞典
2.問題分析
キーは、指定されたアクセントを使用して重複を許可するシーケンスを作成し、ソートすることです.product/composition/permutationの違いを覚えておいてください.混同しないでください.
3.私の回答
from itertools import product
def solution(word):
    words = []
    for i in range(1, 6):
        words += [''.join(word) for word in list(product(['A', 'E', 'I', 'O', 'U'], repeat=i))]
    
    words.sort()
    return words.index(word) + 1