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