#include <iostream>
#include <string>
#include <algorithm>

int main() {
	std::string s;
	std::cin >> s;
	
	int best = s.size();
	int prev = -1;
	int next;
	
	while ((next = s.find_first_not_of("*", prev+1)) >= 0) {
		if (prev >= 0 && s[prev] != s[next]) {
			best = std::min(best, next - prev - 1);				
		}
		prev = next;
	} 
	std::cout << best;
	return 0;
}