#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  string str;
  cin >> N >> str;
  int A = 0;
  int W = 0;
  int T = 0;
  int R = 0;
  
  for(int i = 0; i < N; i++){
    if(str.at(i) == 'AC'){
      A++;
    }
    if(str.at(i) == 'WA'){
      W++;
    }
    if(str.at(i) == 'TLE'){
      T++;
    }
    if(str.at(i) == 'RE'){
      R++;
    }
  }
  cin >> A >> W >> T >> R;
  
  cout << "AC" << x << A << endl;
  cout << "WA" << x << W << endl;
  cout << "TLE" << x << T << endl;
  cout << "RE" << x << R << endl;
}