The string of letters is given. How many subsequences "ABA" does it contain? The letters "ABA" don't have to be consecutive. But the order of letters should be the same.
One line that contains only capital Latin letters. The length of the string is no more than
Print the number of subsequences "ABA" in the string.