Advertisement
Guest User

Untitled

a guest
Dec 26th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. with open(r'24-0.txt', 'r') as file:
  2.     c = 0
  3.     for s in file:
  4.         s = s.strip()
  5.         flag1, flag2 = False, False
  6.         for sym in s:
  7.             if (not flag1) and (not flag2):
  8.                 if sym == 'A':
  9.                     flag1 = True
  10.             elif flag1:
  11.                 flag1 = False
  12.                 flag2 = True
  13.             elif flag2:
  14.                 if sym == 'R':
  15.                     c += 1
  16.                     break
  17.                 else:
  18.                     flag1, flag2 = False, False
  19.  
  20.     print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement