s = raw_input()

root = {
  'parent': None,
  'child': {},
  'odds': 0
}

i = 0
for c in s:
  i += 1
  nodes = [root]
  while nodes:
    nex = []
    for d in nodes:
      d[c] = d.get(c, 0) + 1
      d['odds'] += 1 if d[c] % 2 == 1 else -1
      if d['odds'] == 0 and d['parent']:
        del d['parent']['child'][d['no']]
        continue
      nex += d['child'].values()
      if d['odds'] <= 1:
        d['child'][i] = { 'parent': d, 'no': i, 'child': {}, 'odds': 0 }
    nodes = nex

ans = 1
nodes = [root]
while nodes:
  nex = []
  for n in nodes:
    if n['odds'] <= 1:
      print ans
      exit()
    nex += n['child'].values()
  nodes = nex
  ans += 1
print "error"