#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  string s;
  cin >> t;
  int x = 0, y = 0, z = 0, q = 0;
  while (t--) {
    cin >> s;
    if (s == "AC") x++;
    if (s == "WA") y++;
    if (s == "TLE") z++;
    if (s == "RE") q++;
  }
  cout << "AC"
       << "*" << x << endl;
  cout << "WA"
       << "*" << y << endl;
  cout << "TLE"
       << "*" << z << endl;
  cout << "RE"
       << "*" << q << endl;
  return 0;
}
