program ABC151C
    implicit none
    integer::N,M
    integer::p
    character(2)::S
    logical,allocatable,dimension(:)::AC
    integer,allocatable,dimension(:)::cntWA
    integer::ACcnt,Pen
    integer::i
    read*,N,M
    allocate(AC(N),cntWA(N))
    AC=.false.
    cntWA=0
    do i=1,M
        read*,p,S
        if(S=="AC")then
            AC(p)=.true.
        else
            if(AC(p))cycle
            cntWA(p)=cntWa(p)+1
        endif
    end do
    ACcnt=0;Pen=0
    do i=1,N
        if(AC(i))then
            ACcnt=ACcnt+1
            Pen=Pen+cntWA(i)
        endif
    end do
    print"(i0,A,i0)",ACcnt," ",Pen
end program ABC151C