program judge

 implicit none
 integer::n,ans1,ans2,ans3,ans4,i
 character,allocatable::s(:)*3

 read*,n
 allocate(s(n))

 read*,s

! print*,s

ans1=0
ans2=0
ans3=0
ans4=0


do i=1,n
 if(s(i)=='AC') then
  ans1=ans1+1
 end if
 
 if(s(i)=='WA') then 
   ans2=ans2+1
 end if

 if(s(i)=='TLE') then
   ans3=ans3+1
 end if

 if(s(i)=='RE') then 
   ans4=ans4+1
 end if


end do


print*,'AC x ',ans1
print*,'WA x ',ans2
print*,'TLE x ',ans3
print*,'RE x ',ans4

end program judge