1#include <bits/stdc++.h>
2
3using namespace std;
4
5int main()
6{
7 string s;
8 cin>>s;
9 int l=s.length();
10 map<char,int>mp;
11 int mx=INT_MIN;
12 int i=0;
13 int j=0;
14 while(j<l)
15 {
16 mp[s[j]]++;
17 if(int(mp.size())<j-i+1)
18 {
19 while(int(mp.size())<j-i+1)
20 {
21 mp.erase(s[i]);
22 i++;
23 }
24 j++;
25 }
26 else if(int(mp.size())==j-i+1)
27 {
28 mx=max(mx,j-i+1);
29 j++;
30 }
31 }
32 cout<<mx;
33 return 0;
34}
35