Farz0l1x

Untitled

Apr 3rd, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. file = open('15.txt')
  2. text = file.readline()
  3. d = dict()
  4. Max = 0
  5. for c in text:
  6. if c in d:
  7. d[c] += 1
  8. Max = max(Max, d[c])
  9. else:
  10. d[c] = 1
  11. ans = []
  12. for c in d:
  13. if d[c] == Max:
  14. ans.append(c)
  15. ans.sort()
  16. print(ans[0], text.count('W'))
Advertisement
Add Comment
Please, Sign In to add comment