We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
from collections import Counter
if __name__ == '__main__':
s = input().strip()
ctr = Counter(s)
for key, item in sorted(ctr.items(), key=lambda x: (-x[1], x[0]))[:3]:
print(f"{key} {item}")
Cookie support is required to access HackerRank
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 →