Farz0l1x

Untitled

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