N = int(input())
for s in range(N):
  s = (input()
       print('AC','x',s.count('AC'))
       print('TLE','x',s.count('TLE'))
       print('WJ','X',s.count('WJ'))
       print('RE','X',s.count('RE'))
