#include using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout< ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<>=1,k++)s=(s<<1)|(u&1);for(;0>=1)cout<<(s&1);}} #define TIME chrono::system_clock::now() #define MILLISEC(t) (chrono::duration_cast(t).count()) template ostream& operator <<(ostream &o,const pair p){o<<"("< memo; if (idx == n-1) return 0; int key = idx|(left<<13)|(stage<<26); if (memo.count(key)) return memo[key]; int result = 0; switch (stage){ // PPAP case 0: case 1: if (is_kaibun(left,idx)){ result += dfs(idx+1,stage+1,idx+1); } result += dfs(idx+1,stage,left); break; case 2: return 0; if (is_kaibun(idx+1,n-1)){ result+=1; } result += dfs(idx+1,stage,left); break; } return memo[key] = result; } int main(){ int i,j,k; int x,y,a,b; cin >> str; n = str.size(); cout << dfs() << endl; return 0; }