I,R=input,range N,A,B=map(int,I().split()) S=I()+'0' X=[] c=0 w="con" for s in S: if s==w[c%3]:c+=1 else:X,c=X+[c//3],s=="c" D=[0]+[-N]*N L=1 for x in X: L+=x//A for i in R(L,-1,-1): for j in R(min(x//A,i)+1):D[i]=max(D[i],(x-A*j)//B+D[i-j]) print(max([i+min(i,D[i])for i in R(L)]))