#include <bits/stdc++.h>


using namespace std;



void solve(){
	string s; cin>>s;
	int n = s.length();
	int razlika=0;
		int l=0,d=n-1;
	if(s[0]=='b'&&s[1]=='b' || s[n-2]=='b'&&s[n-1]=='b'){
		cout<<3;
	}else{
		while(d>=l){
			if(s[l]==s[d]){
				l++;
				d--;
			}else{
				razlika=d-l;
				d=-1;	
			}
		}
		if(razlika==0){
			cout<<1<<endl;
		}else{
			cout<<2<<endl;
		}
		
	}

}



int main()
{
	ios::sync_with_stdio(0); 
	cin.tie(0);
	solve();
	
}