re = $stdin.readline.chomp.each_char.to_a.sort

b = '0'
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
end
res += if r>=3 then 3 else r end
puts res