Miscellany
public text v1 · immutablecnt = {'2': 2, '3': 1, '4': 7, '5': 4}
# fill the line below with all possible tiles
tiletypes = {'2': 1, '3': 1, '4': 1, '5': 1}
finalcount = {}
for tile in cnt:
tiletype = tiletypes[tile]
finalcount[tiletype] = finalcount.get(tiletype,0) + cnt[tile]
print finalcount