#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int l=0;
int r=0;
int max1=0;
vector<int>v(256,0);
if(s.size()==0){
cout<<0;
}
else if(s.size()==1){
cout<<1;
}
else{
while(r < s.size()){
while(v[s[r]] == 1){
v[s[l]]=0;
l++;
}
v[s[r]]=1;
max1=max(max1,r-l+1);
r++;
}
cout<<max1;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKXsKCQoJc3RyaW5nIHM7CgljaW4+PnM7CglpbnQgbD0wOwoJaW50IHI9MDsKCWludCBtYXgxPTA7Cgl2ZWN0b3I8aW50PnYoMjU2LDApOwoJaWYocy5zaXplKCk9PTApewoJCWNvdXQ8PDA7Cgl9CgllbHNlIGlmKHMuc2l6ZSgpPT0xKXsKCQljb3V0PDwxOwoJfQoJZWxzZXsKCQl3aGlsZShyIDwgcy5zaXplKCkpewoJCQkgd2hpbGUodltzW3JdXSA9PSAxKXsKCQkJIAkgIHZbc1tsXV09MDsKCQkJIAkgIGwrKzsKCQkJIH0KCQkJIHZbc1tyXV09MTsKCQkJIG1heDE9bWF4KG1heDEsci1sKzEpOwoJCQkgcisrOwoJCX0KCQljb3V0PDxtYXgxOwoJfQoJcmV0dXJuIDA7Cn0=