#include <iostream>
#include <algorithm>
#include <string>
#include <cstring> #define INF 0xfffffff
using namespace std;
const int maxn = ;
int a[maxn]; bool is_ok(){
for (int i = ; i < ; i++){
if (!a[i])
return false;
}
return true;
} int main(){
ios::sync_with_stdio(false);
string s;
cin >> s;
memset(a, , sizeof(a));
bool flag = true;
a[s[] - 'A']++;
int ans = INF;
int l = ;
for (int i = ; i < s.length(); i++){
a[s[i] - 'A']++;
while (is_ok())
{
ans = min(ans, i - l + );
a[s[l++] - 'A']--;
}
}
if (ans == INF){
cout << "No Solution" << endl;
}
else
cout << ans << endl;
system("pause");
return ;
}