You have given a string A having Uppercase English letters.
You have to find the number of pairs (i, j) such that A[i] = 'A', A[j] = 'G' and i < j.
1 <= length(A) <= 105
First and only argument is a string A.
Return an long integer denoting the answer.
Input 1:
A = "ABCGAG"
Input 2:
A = "GAB"
Output 1:
3
Output 2:
0
Explanation 1:
Subsequence "AG" is 3 times in given string
Explanation 2:
There is no subsequence "AG" in the given string.