[Python] [Algorithm] 가장 많이 등장하는 알파벳 갯수 세기
word = "chanhhh" def highFrequencyLetterCount(word): map = {} for alphabet in word: print("map :",map) if map.get(alphabet) == None: map[alphabet] = 1 else: map[alphabet] += 1 print(map) max = -1 for key in map: print("key :", key, "value :", map[key], "max :", max) if map[key] > max: max = map[key] print(max) return max highFrequencyLetterCount(word)
2021.06.24