**Problem Description**

**Input**

There are several test cases.

Each case there is a line containing two integers N and M(3<=N,M<=10). Following is N lines. Each line there are M capital letters meaning the information of the photo.

**Output**

For each case output an integer meaning the number of "ACM"s that the photo contains. The "A" "C" "M" three characters appears in turn that counts as one time. No matter vertical of horizontal is both ok. One character can appear in several "ACM" strings.

**Sample Input**

3 3 ACM CMA MCA 4 3 ACM ACM ACM ACM

**Sample Output**

2 4