You are viewing a single comment's thread. Return to all comments →
#!/bin/python3 import heapq from collections import Counter if __name__ == '__main__': s = input(); i = 0 tabs = Counter(s); heap = [] for k,v in tabs.items(): heapq.heappush(heap, (-v, k)) while heap and i < 3: tmp = heapq.heappop(heap) print(tmp[1], -tmp[0]) i += 1
Seems like cookies are disabled on this browser, please enable them to open this website
Company Logo
You are viewing a single comment's thread. Return to all comments →