#janken G,C,P=(int(i) for i in input().split()) S=input() T=0 for i in range(len(S)): if S[i]=="G" and G>0: T+=1 G-=1 if S[i]=="C" and C>0: T+=1 C-=1 if S[i]=="P" and P>0: T+=1 P-=1 print (T)