Problems
ABA
ABA
The string of letters is given. How many times the subsequence "\textbf{ABA}" occurs in the given string? The letters "\textbf{ABA}" may not be adjacent, but their order must be preserved.
\InputFile
One line containing only uppercase Latin letters. The length of the string does not exceed $10^6$.
\OutputFile
Print the number of occurrences of the subsequence "\textbf{ABA}" in the string.
Input example #1
YARBRBAQ
Output example #1
2
Input example #2
ABAYBATATBBAZA
Output example #2
29