re = $stdin.readline.chomp.each_char.to_a.sort.map(&:ord)

b = -1
r = 0
res = 0
until re.empty?
  c = re.shift
  if b==c
    b = b.succ
    r += 1
  elsif b==c.succ
    re.push c
  else
    b = c.succ
    res += if r>=3 then 3 else r end
    r=1
  end
  if re.group_by{|i|i}.to_a.size==1
    if b == c.succ
      r+=1
      re.shift
    else
      res += re.size
      break
    end
  end
end
res += if r>=3 then 3 else r end
puts res