#include #define syosu(x) fixed< P; typedef pair pdd; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vs; typedef vector

vp; typedef vector vvp; typedef vector vpll; typedef pair pip; typedef vector vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-9; const ll mod=1e6+7; const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0}; int A,B,C; string s; vector dp; int f(int x,char c){ int y=0; if(c=='C') y=1; if(c=='P') y=2; if(x==y) return 1; if((x+1)%3==y) return 3; return 0; } int Rec(int x,int y,int z){ if(dp[x][y][z]!=-1) return dp[x][y][z]; int res=0,I=A+B+C-x-y-z; if(x) res=max(res,Rec(x-1,y,z)+f(0,s[I])); if(y) res=max(res,Rec(x,y-1,z)+f(1,s[I])); if(z) res=max(res,Rec(x,y,z-1)+f(2,s[I])); return dp[x][y][z]=res; } int main(){ cin>>A>>B>>C>>s; dp=vector(A+1,vvi(B+1,vi(C+1,-1))); cout<