下面是用 C 语言实现的代码:
#include <stdio.h>
#include <string.h>
int main()
{
int n;
scanf("%d", &n);
int count_a = 0, count_b = 0;
char s[20]; // 存储输入的字符串
for (int i = 0; i < n; i++) {
scanf("%s", s);
if (strcmp(s, "A") == 0) {
count_a++;
} else