#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0;i<(n);i++) int main(){ string S; cin>>S; set,int>> G; pair,int> p = {{0,0},0}; G.insert(p); string X = "abc"; auto rotR = [&X]()->void{ X = string({X[2],X[0],X[1]}); }; auto rotL = [&X]()->void{ X = string({X[1],X[2],X[0]}); }; for(char c:S){ int i = X.find(c); if(i==0){ if(p.second){ rotR(); } else{ rotR(); p.first.first--; } } if(i==1){ if(p.second){ rotL(); p.first.first++; } else{ rotL(); } } if(i==2){ if(p.second){ p.first.second++; } else{ p.first.second--; } } p.second = 1 - p.second; G.insert(p); } cout<