PnnK

task 24

Jun 18th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. f = open(r'C:\Users\thisp\Desktop\24.txt')
  2. max_seq = 0
  3. curr_seq = 0
  4. for line in f:
  5.     for i in range(1,len(line)):
  6.         if line[i] == 'Y' or line[i] == 'Z':
  7.             if line[i-1] == 'X':
  8.                 max_seq = max(max_seq,curr_seq)
  9.                 curr_seq = 0
  10.         else:
  11.             curr_seq += 1
  12. print(max_seq)
  13.  
Advertisement
Add Comment
Please, Sign In to add comment