Happy Couple
Time Limit: 1 sec
The Problem
Jony & Tina , a happy couple have a child named “Raju” . He is a pretty baby. Recently he has learnt some words. Many of these are meaningless but the good news is that he can say “BABA” and “MAA” ! His parents are really happy by the sweet sounds of their baby.
Everyday their baby says many words having “BABA” and “MAA” words also. Now they hire you to count how many times their baby said those words.
The Input
Input will be multiple test cases. A test case will have only one string of S length having no space (string can consist of uppercase and lowercase letters only) . Your task is to find the value of B and M where B & M are the number of times the baby says “BABA” & “MAA” respectively.
Constraints
1<= S <= 10^5
The Output
For each test case print the value of B and M as the following format “BABA = B , MAA = M” .
Sample Input
baMaABaBa
BABAMaaMAA
MAA
MAbAZBzMAMAABAbA
Sample Output
BABA = 1 , MAA = 1
BABA = 1 , MAA = 2
BABA = 0 , MAA = 1
BABA = 1 , MAA = 1
[Note: “ BABA” & “MAA” can be combination of uppercase & lowercase letters. ]
Inter University Programming Contest(I) - 2018 [BGC Trust University Bangladesh]
Problem Setter: Hafiz Al Asad