Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import accumulate
- def flt(x):
- if x == 'A':
- return 1
- elif x == 'C':
- return -1
- elif x == 'B':
- return 0
- n, k = map(int, input().split())
- students = list(accumulate(map(flt, input())))
- for i in range(n):
- if students[i] < 0:
- print(students[-1] - students[i])
- exit()
- print(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement