numberotestcase = int(input())
verdicat=[]
for step in range(numberotestcase):
  exp = input().upper()
  verdicat.append(exp)

first = verdicat.count('AC')
sec =  verdicat.count('WA')
thir =  verdicat.count('TLE')
fou = verdicat.count('RE')
print('AC * '+str(first))
print('WA * '+str(sec))
print('TLE * '+str(thir))
print('RE * '+str(fou))