object Main extends App {
    var get = readLine.split("")
  var sum = 0
  var i = 0
  while( i < get.size-2) {
    if(get(i)=="A" && get(i+1)=="B" && get(i+2)=="C") {
      get(i)="B"
      get(i+1)="C"
      get(i+2)="A"
      i=0
      sum = sum + 1
    } else {
      i=i+1
    }
  }
  println(sum)
}