import sys

sys.setrecursionlimit(10000000)

s = input()

def check(str):
	temp = {}
	for i in str:
		if i not in temp:
			temp[i] = 0
		temp[i]+=1
	flag = 0
	for i in temp:
		flag += temp[i]%2
		if flag >1:
			return False
	return True

def check2(str,x):
	if str=="" or check(str):
		return x
	count = len(str)-1
	while(not check(str[0:count])):
		count -= 1
	return check2(str[count:],x+1)

a = min(check2(s,1),check2(s[::-1],1))
print(a)