object Main extends App {
  import scala.io.StdIn._


  val str = readLine.trim
  val characters = ('a' to 'z').map(c ⇒ str.count(_ == c)).toArray
  val numbers = ('0' to '9').map(c ⇒ str.count(_ == c)).toArray
  var replaced = 0
  for (from ← 0 until 26; to ← (from + 2 until 26).reverse) {
    while ((from to to).forall(i ⇒ characters(i) > 0)) {
      replaced += 3
      (from to to).foreach(i ⇒ characters(i) -= 1)
    }
  }
  for (from ← 0 to 9; to ← (from + 2 to 9).reverse){
    while((from to to).forall(i ⇒ numbers(i) > 0)){
      replaced += 3
      (from to to).foreach(i ⇒ numbers(i) -= 1)
    }
  }
  println(replaced + characters.sum + numbers.sum)
  implicit class Scope[T](val value: T) extends AnyVal{
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}

