The string of letters is given. How many times the subsequence "ABA" occurs in the given string? The letters "ABA" may not be adjacent, but their order must be preserved.
One line containing only uppercase Latin letters. The length of the string does not exceed 106.
Print the number of occurrences of the subsequence "ABA" in the string.