Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = ''
- with open('24.txt') as f:
- s = f.readline()
- s = s.replace('AA', '*')
- a = s.split('*')
- #print(s)
- #print(a)
- kmax = 1
- #1, posl - otdel
- t = a[0]
- if len(t) != 0:
- k = len(t) + 1
- if t[-1] == 'A':
- k -= 1
- kmax = max(k, kmax)
- t = a[-1]
- if len(t) != 0:
- k = len(t) + 1
- if t[0] == 'A':
- k -= 1
- kmax = max(k, kmax)
- for i in range(1, len(a) - 1):
- t = a[i]
- if len(t) == 0:
- continue
- k = len(t) + 2
- if t[0] == 'A':
- k -= 1
- if t[-1] == 'A':
- k -= 1
- kmax = max(k, kmax)
- print(kmax)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement