Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('24_1352.txt')
- a = list()
- buff = ''
- s = f.read()
- sl = s.split()
- p = list()
- for el in sl:
- for i in range(len(el)):
- if el[i] in 'XYZ':
- buff += el[i]
- else:
- if len(buff) != 0:
- a.append(buff)
- buff = ''
- a.append(buff)
- mc = 0
- mxs = ''
- for el in a:
- for q in range(3):
- c = 0
- buff = ''
- for i in range(q, len(el), 3):
- if i + 2 > len(el) - 1:
- c += 1
- break
- if el[i] == 'X' and el[i + 1] == 'Y' and el[i + 2] == 'Z':
- if i != q and c == 0:
- c = 1
- buff = el[i]
- buff += 'XYZ'
- c += 3
- else:
- c += 1
- buff += el[i]
- if c > mc:
- mxs = buff
- buff = ''
- mc = c
- c = 1
- buff = el[i]
- if c > mc:
- mxs = buff
- buff = ''
- mc = c
- print(mc, mxs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement