#include <bits/stdc++.h>
int main() {
  int n, i, ac = 0, tle = 0, wa = 0, re = 0;
  scanf("%d", &n);
  char s[1000];
  while (n--) {
    scanf("%s", s);
    if (s[i] == 'A' && s[i + 1] == 'C') {
      ac++;
    } else if (s[i] == 'W' && s[i + 1] == 'A') {
      wa++;
    } else if (s[i] == 'T' && s[i + 1] == 'L' && s[i + 2] == 'E') {
      tle++;
    } else {
      re++;
    }
  }
  printf("ACX%d\n", ac);
  printf("WAX%d\n", wa);
  printf("TLEX%d\n", tle);
  printf("REX%d\n", re);
}
