s = gets.chomp
sum = 0
cusum = [sum]
s.chars{|c|
  cusum << (sum ^= (1 << c.ord - 0x61))
}

f = ->l,r{
  n = cusum[r] ^ cusum[l]
  n.to_s(2).count(?1) < 2
}

g = ->l,r{
  while !f[l,r]
    r -= 1
  end
  r
}

l = 0
ans1 = 0
loop {
  l = g[l, s.size]
  ans1 += 1
  break if l == s.size
}

h = ->l,r{
  while !f[l,r]
    l += 1
  end
  l
}

r = s.size
ans2 = 0
loop {
  r = h[0, r]
  ans2 += 1
  break if r == 0
}

p [ans1, ans2].min
