local str = io.read()
local index = 1
local tStr = {}
for i = 1, #str do
    tStr[i] = string.sub(str, i, i)
end
local sum = 0
local function A(index)
    for i = index, #str -  2 do
        if string.byte(tStr[i]) == string.byte(tStr[i + 1]) - 1 and string.byte(tStr[i]) == string.byte(tStr[i + 2]) - 2 then
            tStr[i] = "B"
            tStr[i + 1] = "C"
            tStr[i + 2] = "A"
            sum = sum + 1
            if index > 1 then
                A(index - 1)
            end
        end
    end
    if index <= #str -  2 then
        A(index + 1)
    end
end
A(1)
print(sum)