4
2
4
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
const int maxn = 10010;
char str[maxn];
bool vis[30];//hash
inline int ind(char x) {
return x - 'a';
}
void work() {
int maxv = 0;
int i, j, cnt = 0;
int len = strlen(str);
memset(vis, false, sizeof(vis));
for(i = 0; i < len; i++) {
memset(vis, false, sizeof(vis));
cnt = 0;
for(j = i; j < len; j++) { //开始没有回溯,wa
char t = str[j];
if(!vis[ind(t)]) {
vis[ind(t)] = true;
cnt++;
if(maxv < cnt) maxv = cnt;
}else break;
}
}
printf("%d
", maxv);
}
int main()
{
memset(str, ' ', sizeof(str));
while(scanf("%s", str) != EOF) {
getchar();
work();
memset(str, ' ', sizeof(str));
}
return 0;
}