Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n,k=map(int,input().split())
- line=input()
- pos=k
- f=0
- if pos < 0:
- f = - pos
- pos = 0
- for i in range(n-1):
- ig=line[i]
- if ig=='C':
- pos-=1
- if ig=='A':
- pos+=1
- if pos<0:
- f+=1
- pos=0
- print(f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement