Skip to content

Commit

Permalink
2024.03.13 another solve
Browse files Browse the repository at this point in the history
  • Loading branch information
JangHongJoon committed Mar 13, 2024
1 parent 332b998 commit 1c578ac
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions wkdghdwns199/집합과_맵/ACM-20902.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
word = input().rstrip()
if len(word) >= M :
if word in word_count :
word_count[word] += 1
word_count[word][0] += 1
else :
word_count[word] = 1
word_count[word] = [1,len(word)]

# print(word_count.items())
sorted_word_list = sorted(word_count.items(), key=lambda word_info : (-word_info[1], -len(word_info[0]), word_info[0]))
# print()
print()
for key in word_count :
print (key)

sorted_word_list = sorted(word_count, key=lambda key : (-word_count[key][0], -word_count[key][1], key))
print()
for word in sorted_word_list :
print(word[0])
print(word)

0 comments on commit 1c578ac

Please sign in to comment.