var main = standardInput => {
  var s = standardInput;
  var count = 0;

  while (s.indexOf("ABC") !== -1) {
    var i = s.indexOf("ABC");
    var before = s.substr(0,i)
    var after = s.substr(i+3) || ""
    s = before + "BCA" + after;
    count += 1;
    // console.log(s)
  }
  console.log(count);
};

main(require("fs").readFileSync("/dev/stdin", "UTF-8"));
