program r20718j
 
implicit none
integer :: ac, wa, tle, re, n, i
character(len=3) :: a
 
ac = 0
wa = 0
tle = 0
re = 0
 
read *, n
 
do i = 1, n
 
 read *, a
 
 if (trim(a) == 'AC') then
  ac = ac + 1
 else if (trim(a) == 'WA') then
  wa = wa + 1
 else if (trim(a) == 'TLE') then
  tle = tle + 1
 else
  re = re + 1
 end if
end do
 
print *, 'AC x ', ac
print *, 'WA x ', wa
print *, 'TLE x ', tle
print *, 'RE x ', re
 
end program r20718j