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]*(c>2),0 D=[0]+[-1]*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],[-1,(x-A*j)//B+D[i-j]][D[i-j]>=0]) print(max([[0,i+min(i,D[i])][D[i]>i-2]for i in R(L)]))