Farz0l1x

Untitled

Apr 16th, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. file = open('18.txt')
  2. text = file.readline()
  3. Max = 0
  4. d = dict()
  5. for i in range(2, len(text) - 2):
  6.     if text[i - 2] + text[i - 1] == 'CB' and text[i + 1] + text[i + 2] == 'BC':
  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. for elem in d:
  13.     if d[elem] == Max:
  14.         print(elem)
  15. print(Max)
Advertisement
Add Comment
Please, Sign In to add comment