N = int(input())
s = [input() for i in range(N)]
a = s.count("AC")
b = s.count("WA")
c = s.count("TLE")
d = s.count("RE")
print("AC * {}".format(a))
print("WA * {}".format(b))
print("TLE * {}".format(c))
print("RE * {}".format(d))