import sys
sys.setrecursionlimit(10000000)
s = input()
def check(str,flag):
	print(str)
	if str == "":
		return True
	flag += str.count(str[0])%2
	if flag >1:
		return False
	else:
		return check(str.replace(str[0],""),flag)

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