Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('18.txt')
- text = file.readline()
- Max = 0
- d = dict()
- for i in range(2, len(text) - 2):
- if text[i - 2] + text[i - 1] == 'CB' and text[i + 1] + text[i + 2] == 'BC':
- if text[i] in d:
- d[text[i]] += 1
- Max = max(Max, d[text[i]])
- else:
- d[text[i]] = 1
- for elem in d:
- if d[elem] == Max:
- print(elem)
- print(Max)
Advertisement
Add Comment
Please, Sign In to add comment