dxnge

25

Oct 21st, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. with open('24.txt') as f:
  2.     a = f.read()
  3.     cnt = float('-inf')
  4.     b = 0
  5.     for i in range(1, len(a)-1):
  6.         if a[i] != a[i-1] and a[i] != a[i+1]:
  7.             b += 1
  8.             if cnt < b:
  9.                 cnt = b
  10.         else:
  11.             b = 0
  12. print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment