program prob3
    implicit none
    integer::i, j, N, M, p, ac, pe
    integer, allocatable::v(:), c(:)
    character(len=2)::S
    read(*,*) N, M
    allocate(v(N), c(N))
    v = 0
    c = 0
    ac = 0
    pe = 0

    do i = 1, M
        read(*,*) p, S
        if(S .eq. "WA" .and. c(p) == 0) then
            v(p) = v(p) + 1
        else if(S .eq. "AC" .and. c(p) == 0) then
            ac = ac + 1
            pe = pe + v(p)
            c(p) = 1
        end if
    end do
    write(*,*) ac, pe
    deallocate(v, c)
    stop
end program