#include using namespace std; //#define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' #define vec vector #define mat vector > #define fi first #define se second typedef long long ll; typedef unsigned long long ull; typedef pair pll; typedef long double ld; typedef complex comp; const ll INF=1e9+7; const ll inf=INF*INF; const ll MOD=1e9+7; const ll mod=MOD; const ll MAX=200010; const double PI=acos(-1.0); signed main(){ string s;cin>>s; ll now=0; ll x=0,y=0; setst; ll n=s.size(); st.insert(mp(x,y)); rep(i,n){ if(now==0){ if(s[i]=='a'){ now=1; x++; }else if(s[i]=='b'){ now=3; y++; }else{ now=5; x--; } }else if(now==1){ if(s[i]=='a'){ now=0; x--; }else if(s[i]=='b'){ now=4; x++; }else{ now=2; y--; } }else if(now==2){ if(s[i]=='a'){ now=3; x--; }else if(s[i]=='b'){ now=5; x++; }else{ now=1; y++; } }else if(now==3){ if(s[i]=='a'){ now=2; x++; }else if(s[i]=='b'){ now=0; y--; }else{ now=4; x--; } }else if(now==4){ if(s[i]=='a'){ now=5; y++; }else if(s[i]=='b'){ now=1; x--; }else{ now=3; x++; } }else{ if(s[i]=='a'){ now=4; y--; }else if(s[i]=='b'){ now=2; x--; }else{ now=0; x++; } } st.insert(mp(x,y)); } cout<