#include<iostream>
#include<string>
using namespace std;

int main(){
	
	string rec;
	
	cin>>rec;
	
	int fleg=0;
	
	if(rec.length()<=26){
		
		cout<<0;
		
	}else{
		if(rec.length()==27){
			for(int i=0;i<rec.length();i++){
				if(rec[i]==rec[i+1]){
					fleg=1;
				}
			}
			if(fleg==1){
				cout<<2;
			}else{
				cout<<1;
			}
		}
	
	}
	return 0;
}