ABA#9594

ABA

1 second
128 megabytes
Very easy

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.

Input

One line containing only uppercase Latin letters. The length of the string does not exceed 10^6.

Output

Print the number of occurrences of the subsequence "ABA" in the string.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading