import Prelude check :: [Char] -> Int -> Int check [] s = 0 check (a:b) s = if a == 'A' then (s + (check b s)) else check b (s+1) main = do string <- getLine print(check string 0)