#include <bits/stdc++.h>
using namespace std;
string s[100005];
int main() {
  int n, suma = 0, sumw = 0, sumt = 0, sumr = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    if (s[i] == "AC") suma++;
    if (s[i] == "WA") sumw++;
    if (s[i] == "TLE") sumt++;
    if (s[i] == "RE") sumr++;
  }
  cout << "AC" << '*' << suma << endl;
  cout << "WA" << '*' << sumw << endl;
  cout << "TLE" << '*' << sumt << endl;
  cout << "RE" << '*' << sumr << endl;
  return 0;
}
