Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("24.txt") as file:
- s = file.readline().strip()
- n = len(s)
- cur = mx = 1
- for i in range(1, n):
- if (s[i] == "d" and s[i-1] == "a") or (s[i] == "a" and s[i-1] == "d"):
- cur = 1
- else:
- cur += 1
- mx = max(mx, cur)
- print(mx)
Advertisement
Add Comment
Please, Sign In to add comment