program main
    use iso_fortran_env
    implicit none
    integer(int32) :: n, i
    integer(int32) :: ac, wa, tle, re
    character(3) :: si

    ac = 0
    wa = 0
    tle = 0
    re = 0
    read *, n

    do i = 1, n
        read *, si
        if (trim(si) == "AC") then
            ac = ac + 1
        elseif (trim(si) == "WA") then
            wa = wa + 1
        elseif (trim(si) == "TLE") then
            tle = tle + 1
        elseif (trim(si) == "RE") then
            re = re + 1
        endif
    enddo

    print "( 'AC x ', i0 )", ac
    print "( 'WA x ', i0 )", wa
    print "( 'TLE x ', i0 )", tle
    print "( 'RE x ', i0 )", re

end program main