Farz0l1x

Untitled

Apr 3rd, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. file = open('15.txt')
  2. text = file.readline()
  3. d = dict()
  4. Max = 0
  5. Min = 1000000000000000000
  6. for c in text:
  7. if c in d:
  8. d[c] += 1
  9. Min = min(Min, d[c])
  10. Max = max(Max, d[c])
  11. else:
  12. d[c] = 1
  13. ans_max = []
  14. ans_min = []
  15. for c in d:
  16. if d[c] == Max :
  17. ans_max.append(c)
  18. ans_max.sort()
  19. for c in d:
  20. if d[c] == Min:
  21. ans_min.append(c)
  22. ans_min.sort()
  23. print(ans_max[0], len(ans_min))
Advertisement
Add Comment
Please, Sign In to add comment