Takahashi participated in a contest on AtCoder.
The contest had N problems.
Takahashi made M submissions during the contest.
The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).
The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.
The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.
Find the numbers of Takahashi's correct answers and penalties.

-----Constraints-----
 - N, M, and p_i are integers.
 - 1 \leq N \leq 10^5
 - 0 \leq M \leq 10^5
 - 1 \leq p_i \leq N
 - S_i is AC or WA.

-----Input-----
Input is given from Standard Input in the following format:
N M
p_1 S_1
:
p_M S_M

-----Output-----
Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

-----Sample Input-----
2 5
1 WA
1 AC
2 WA
2 AC
2 WA

-----Sample Output-----
2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.
In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.
Thus, he has two correct answers and two penalties.

Difficulty: introductory

Starter code:

Solutions:
N, M = [int(n) for n in input().split()]

submit = []
AC = [0] * N
WA = [0] * N

for i in range(M):
    p, s = [n for n in input().split()]
    p = int(p)

    if AC[p-1] == 1:
        continue

    if s == 'AC':
        AC[p-1] = 1
 
    elif s == 'WA':
        WA[p-1] += 1

pen = [x*y for x, y in zip(AC, WA)]

print(sum(AC), sum(pen))

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_list = [0] * N
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    num = int(num) - 1
    if num not in ac_set:
        if res == 'AC':
            ac_cnt += 1
            wa_cnt += wa_cnt_list[num]
            ac_set.add(num)
        else:
            wa_cnt_list[num] += 1
print(ac_cnt, wa_cnt)

# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 16:23:28 2020

@author: liang
"""

N, M = map(int, input().split())
AC_list = [0]*N
WA_list = [0]*N

for i in range(M):
    p, j = input().split()
    p = int(p)
    if j == 'AC':
        AC_list[p-1] += 1
    else:
        if AC_list[p-1] == 0:
            WA_list[p-1] += 1

AC = 0
WA = 0
for i in range(N):
    if AC_list[i] >= 1:
        AC += 1
        WA += WA_list[i]
    
print(AC, WA)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls = [0] * N
wa_cnt = 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(idx)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

import sys
def readint():
    return int(sys.stdin.readline())

def readints():
    return tuple(map(int,sys.stdin.readline().split()))

def readintslist(n):
    return [tuple(map(int,sys.stdin.readline().split())) for _ in range(n)]

def main():
    n,m = readints()
    frag = [False]*(n+1)
    penalties = [0]*(n+1)
    for _ in range(m):
        p,s = input().split()
        p = int(p)
        if frag[p]:
            continue
        if s=="AC":
            frag[p] = True
        else:
            penalties[p] += 1
    print(sum(frag),sum([penalties[i] for i in range(n+1) if frag[i]]))
def __starting_point():
    main()
__starting_point()

n, m = map(int,input().split())
ac = set()
w, x = 0, [0 for i in range(n)]
for i in range(m):
  p, s = input().split()
  l = int(p) -1
  if not l in ac:
    if s == "AC":
      ac.add(l)
      w += x[l]
    else:
      x[l] += 1
print(len(ac),w)

n, m = map(int, input().split())
answers = []
for _ in range(m):
    num,res = input().split()
    num = int(num)
    answers.append([num, res])

AC_cnt = 0
WA_cnt = 0

AC_problems = [0]*n
WA_problems = [0]*n
for answer in answers:
    if answer[1] == 'WA' and AC_problems[answer[0]-1] != 1:
        WA_problems[answer[0]-1] += 1
    else:
        if AC_problems[answer[0]-1] == 0:
            AC_problems[answer[0]-1] += 1
        else:
            continue
for i in range(len(AC_problems)):
    AC_cnt += AC_problems[i]
    if AC_problems[i] == 1:
        WA_cnt += WA_problems[i]

print(AC_cnt, WA_cnt)

n, m = list(map(int,input().split()))
p = [input().split() for _ in range(m)]
ac = [0] * n
wa = [0] * n
for i in p:
    if i[1] == "AC" and ac[int(i[0])-1] == 0:
        ac[int(i[0])-1] = 1
    elif i[1] == "WA" and ac[int(i[0])-1] == 0:
        wa[int(i[0])-1] += 1
wasum = 0
for i in range(n):
    if ac[i] == 1:
        wasum += wa[i]
print(f"{sum(ac)} {wasum}")


n, m= map(int, input().split())
ps = [list(map(str,input().split())) for _ in range(m)]

str_l = ["WA"]*n
int_l = [0]*n
num = 0
ac = 0

for pp, s in ps:
    p = int(pp)-1
    if s == "AC":
        str_l[p] = "AC"
    else:
        if str_l[p] != "AC":
            int_l[p] += 1

for i in range(n):
    if str_l[i] == "AC":
        num += int_l[i]
        ac += 1

print(ac,num)

N, M = map(int, input().split())
p_S = [input().split() for _ in range(M)]

# N, M=O(10^5)なので、O(N+M)で解く！
AC = [False]*N
WA = [0]*N
 
# i番目の提出において、
# (1) まだ'AC'されておらず、提出がWAだった場合：WA += 1
# (2) まだ'AC'されておらず、提出がACだった場合：AC += 1 
# (3) すでに'AC'されている場合：何もしない
for i in range(M):    
  num = int(p_S[i][0])-1
  if AC[num] == 0 and p_S[i][1] == 'WA': WA[num] += 1
  elif AC[num] == 0 and p_S[i][1] == 'AC': AC[num] = True
  else: continue

# 'AC'を出した各問題において、初めて'AC'を出すまでに出した'WA'の数の和を求める
s = 0
for i in range(N):
  if AC[i]:
    s += WA[i]
    
print(sum(AC), s)

N,M = map(int,input().split())
P = []
S = []
AC = [0]*(N+1)
WA = [0]*(N+1)
ac = 0
wa = 0
for i in range(M):
    p,s = input().split()
    P.append(int(p))
    S.append(s)
for i in range(M):
    if(S[i] == "WA" and AC[P[i]] == 0):
        WA[P[i]] += 1
    if(S[i] == "AC"):
        AC[P[i]] += 1
for i in range(1,N+1):
    if(AC[i] >= 1):
        ac += 1
        wa += WA[i]
print(ac,wa)

N,M = map(int,input().split())

#AC,WA
P = [0]*N
Penalty = 0
Accepted = 0

for i in range(M) :
    p,S = input().split()
    p = int(p)
    
    if S == "AC" and P[p-1] != -1:
        Penalty += P[p-1]
        Accepted += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        P[p-1] += 1

print(Accepted,Penalty)

n, m = list(map(int, input().split()))
ac = 0
wa = 0
cur_n = 0
cur_wa = 0
cur_ac = False
pset = []
for i in range(m):
    p, s = input().split()
    pset.append((int(p), s))
pset.sort(key= lambda x:x[0])

for j in range(m):
    if cur_n != pset[j][0]:
        cur_n = pset[j][0]
        cur_ac = False
        cur_wa = 0
    if cur_ac == False:
        if pset[j][1] == 'AC':
            ac += 1
            wa += cur_wa
            cur_ac = True
        else:
            cur_wa += 1

print(f'{ac} {wa}')


n,m = map(int, input().split())
l = [[] for _ in range(n)]
ac,wa = (0,0)
for i in range(m):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if s not in l[p-1]:
      l[p-1].append(s)
      ac += 1
      wa += l[p-1].count("WA")
  else:
    l[p-1].append(s)
print(ac,wa)

N,M = map(int, input().split())
ans = [0]*N
ac = 0
p = 0

for m in range(M):
    a,b = map(str, input().split())
    a = int(a) - 1

    if ans[a] != -1 and b == 'WA':
        ans[a] += 1
    if ans[a] != -1 and b == 'AC':
        ac += 1
        p += ans[a]
        ans[a] = -1

print(ac,p)

N, M = map(int, input().split())
ac = set()
pena = 0
walen = [0]*N

for i in range(M):
    p, S = map(str, input().split())
    p = int(p) - 1
    if p in ac:
        continue
    elif S == 'AC':
        ac.add(p)
        pena += walen[p]
    else:
        walen[p] += 1

print(len(ac), pena)

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    n,m = map(int,input().split())
    wa_answers=np.zeros(n+1,dtype=int)
    ac_flag=np.zeros(n+1,dtype=int)

    for i in range(m):
        no,result=input().split()
        no=int(no)
        if result=="AC" and ac_flag[no]==0:
            ac_flag[no]=1
        if result=="WA" and ac_flag[no]==0:
            wa_answers[no]+=1
    print(sum(ac_flag),sum(ac_flag*wa_answers))
def __starting_point():
    main()
__starting_point()

n, m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]
ans = [0]*n
wa = [0]*n
ac = [0]*n
for i in range(m):
    p, s = int(ps[i][0]), ps[i][1]
    if ac[p-1] == 0:
        if s == 'WA':
            wa[p-1] += 1
        else:
            ans[p-1] = wa[p-1]
            ac[p-1] += 1
print(sum(ac), sum(ans))

from collections import defaultdict
def main():
    n, m = map(int, input().split(" "))
    d = defaultdict(lambda:"")
    dp = defaultdict(lambda:0)
    cnt_p=0
    cnt_ca=0
    for i in range(m):
        p,s = input().split(" ")
        if d[p] == "":
            if s == "AC":
                d[p] = 1
                cnt_ca += 1
                cnt_p += dp[p]
            else:
                dp[p] += 1
    print(f"{cnt_ca} {cnt_p}")


def __starting_point():
    main()
__starting_point()

N, M = map(int, input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)

for i in range (0, M):
    A, B = map(str, input().split())
    A = int(A)
    if B == 'WA':
        if AC[A] == 0:
            WA[A]+=1
    else:
        if AC[A] == 0:
            AC[A] = 1

Wronganswer = 0
for i in range (0, N+1):
    Wronganswer+=(AC[i]*WA[i])
print(sum(AC), Wronganswer)

import numpy as np
n,m=map(int,input().split())
a=np.array([list(input().split()) for i in range(m)])
b=[0]*(n+1)
e=[0]*(n+1)
c=0
d=0
for i in a:
    if b[int(i[0])]==0:
        if i[1]=="AC":
            c+=1
            b[int(i[0])]=1
            d+=e[int(i[0])]
        else:
            e[int(i[0])]+=1
print(c,d)

n, m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

c = [0] * n
for p, s in ps:
    if s == 'AC':
        c[int(p)-1] = 1
d = [0] * n
wa = 0
ac = 0
for p, s in ps:
    if d[int(p)-1] == 0:
        if s == 'WA':
            if c[int(p)-1] == 1:
                wa += 1
        else:
            ac += 1
            d[int(p)-1] = 1
print(ac, wa)

n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(s_i)

correct = [0]*n
penalty = [0]*n

for i in range(m):
    no = p[i]
    if correct[no-1] == 1:
        continue
    elif s[i] == 'WA':
        penalty[no-1] += 1
    elif s[i] == 'AC':
        correct[no-1] = 1

pen = 0
for i in range(n):
    if correct[i] == 1:
        pen += penalty[i]
print(sum(correct), pen)

n,m=map(int,input().split())
l1 = [0]*n
l2 = [0]*n
for i in range(m):
        p,s=map(str,input().split())
        p= int(p)
        if s == 'AC':
                l2[p-1] +=1
        else:
                if l2[p-1] == 0:
                        l1[p-1] +=1
cntac = 0
cntwa = 0
for i in range(n):
        if l2[i] != 0:
                cntac +=1
                cntwa += l1[i]

                
                
print(cntac,cntwa)

n,m = map(int,input().split())
p,s =[],[]
for _ in range(m):
    p_ ,s_ = input().split()
    p.append(int(p_))
    s.append(s_)

AC = [0]*n
WA = [0]*n

for i in range(m):
    if s[i]=="WA" and AC[p[i]-1]==0:
        WA[p[i]-1] += 1
    elif s[i]=="AC" and AC[p[i]-1]==0:
        AC[p[i]-1] += 1
    
for i in range(m):
    if AC[p[i]-1]==0:
        WA[p[i]-1]=0
print(sum(AC),sum(WA))

n, m = map(int, input().split())
d = [0] * (n+1)
ac = 0
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if d[p] == -1:
    continue
  elif s == "AC":
    ac += 1
    wa += d[p] 
    d[p] = -1
  else:
    d[p] += 1
print(ac, wa)

n, m = map(int, input().split())
q = [0 for i in range(n)]
a = [False for i in range(n)]
ans1 = 0
ans2 = 0
for i in range (m):
  p, S = input().split()
  p = int(p) - 1
  if S == 'AC':
    a[p] = True
  else:
    if a[p] == False:
      q[p] += 1
for i in range(n):
  if a[i] == True:
    ans1 += 1
    ans2 += q[i]
print(ans1, ans2)

N, M = map(int, input().split())
pS = [list(input().split()) for _ in range(M)]

b = 0
lst = [0 for _ in range(N)]
for p, S in pS:
  p = int(p)
  if S == "WA" and lst[p-1] <= 0:
    lst[p-1] -= 1
  if S == "AC" and lst[p-1] <= 0:
    b += - lst[p-1]
    lst[p-1] = 1

print(lst.count(1), b)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

N, M = map(int, input().split())
AC = [0] * N
WA1 = [0] * N
WA2 = [0] * N
for i in range(M):
  p, s = input().split()
  if s == 'AC':
    if AC[int(p) - 1] == 0:
      AC[int(p) - 1] = 1
      WA2[int(p) - 1] = WA1[int(p) - 1]
  elif AC[int(p) - 1] == 0:
    WA1[int(p) - 1] += 1
print(str(AC.count(1))+' '+ str(sum(WA2)))

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_list = [0] * N
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    num = int(num) - 1
    if num not in ac_set:
        if res == 'AC':
            ac_cnt += 1
            wa_cnt += wa_cnt_list[num]
            ac_set.add(num)
        else:
            wa_cnt_list[num] += 1
print(ac_cnt, wa_cnt)

n,m = map(int,input().split())
p = []
s = []
for i in range(m):
    P,S = input().split()
    p.append(int(P))
    s.append(S)
question = [0] * n #それぞれの問題のWAの数
ac = 0
wa = 0
for i in range(m):
    if question[p[i] - 1] != -1:
        if s[i] == "AC":
            ac += 1
            wa += question[p[i] - 1]
            question[p[i] - 1] = -1
        else:
            question[p[i] - 1] += 1
print(str(ac) + " " + str(wa))

N,M = map(int,input().split())
P_S = [input().split() for _ in range(M)]
wa_cnt = [0] * N
ac = 0
wa = 0
for p,s in P_S:
  index = int(p)-1
  # ACの場合
  if s == "AC":
    # 初めてではない場合
    if wa_cnt[index] != -1:
      wa += wa_cnt[index]
      wa_cnt[index] = -1
      ac += 1
  else:
    if wa_cnt[index] != -1:
      wa_cnt[index] += 1

print(ac,wa)

n,m=map(int,input().split())
a=[input().split()for _ in range(m)]
c=[0]*n
w=[0]*n
for i in range(m):
    if c[int(a[i][0])-1]==0:
        if a[i][1]=="AC":
            c[int(a[i][0])-1]+=1
        else:
            w[int(a[i][0])-1]+=1
    else:
         pass
for i in range(n):
    if c[i]==0:
        w[i]=0
    else:
        pass
print(sum(c),sum(w))

n, m = list(map(int, input().split()))
answer = 0
penalty = 0
ans = [0] * n
pen = [0] * n

for x in range(m):
  p, s = input().split()
  pi = int(p) - 1
  if ans[pi] == 1:
    continue

  if s == 'AC':
    answer += 1
    ans[pi] = 1
    penalty += pen[pi]
  elif s == 'WA':
    pen[pi] += 1

print(f'{answer} {penalty}')



n,m = map(int,input().split())
p,s = [],[]
for _ in range(m):
  a,b = map(str,input().split())
  p.append(a)
  s.append(b)
p = list(map(int,p))
checker = [0] * n
penalty = [0] * n
ans = 0
for i,j in enumerate(s):
  if j == "AC" and checker[p[i]-1] == 0:
    checker[p[i]-1] = 1
  elif j == "WA" and checker[p[i]-1] == 0:
    penalty[p[i]-1] += 1
for k,l in enumerate(checker):
  if l:
    ans += penalty[k]
print(sum(checker),ans)

N,M=map(int,input().split())
WA=[0]*N
AC=[0]*N
for i in range(M):
    p,S=map(str,input().split())
    if S=='WA' and AC[int(p)-1]!=1:
        WA[int(p)-1]+=1
    elif S=='AC':
        AC[int(p)-1]=1

Q=0
for i in range(N):
    if AC[i]>0:
        Q+=WA[i]
print(sum(AC),Q)

N,M = map(int,input().split())
num_AC,num_WA = 0,0
res = [list(input().split()) for i in range(M)]
check = ['v']*N
WA_check = [0]*N
for i,j in res:
  i = int(i)
  if check[i-1] == 'v':
    if j == 'WA':
      WA_check[i-1] += 1
    if j == 'AC':
      num_AC += 1
      num_WA += WA_check[i-1]
      check[i-1] = '.'
print(num_AC,num_WA)

N,M = map(int, input().split())
d = {'AC':0,'WA':0,}
b = 0
for i in range(N + 1):
  d[i] = 0
for j in range(M):
  p,s = input().split()
  p = int(p)
  if s == 'AC':
    if d[p] != -1:
      b = d[p]
      d[p] = -1
      d['AC'] += 1
      d['WA'] += b
      b = 0  
  if s == 'WA':
    if d[p] != -1:
       d[p] += 1
print(d['AC'],end = ' ')
print(d['WA'])
  



N, M = map(int, input().split())
count1 = 0
count2 = 0
lis = [0] * N
lis2 = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    lis2[p-1] += 1
  elif lis[p-1] == 0 and S == "AC":
    count1 += 1
    lis[p-1] = 1
  elif lis[p-1] == 1 and S == "WA":
    continue
  elif lis[p-1] == 1 and S == "AC":
    continue
for i in range(N):
  if lis[i] == 0:
    lis2[i] = 0
count2 = sum(lis2)
print(str(count1) + " " + str(count2))

N,M=map(int,input().split())
penalty=[0]*N
result=["WA"]*N

for i in range(M):
  P,S=input().split()
  if S=="AC":
    result[int(P)-1]="AC"
  elif S=="WA" and result[int(P)-1]=="WA":
    penalty[int(P)-1]+=1
  else:
    continue

for j in range(N):
  if result[j]=="WA":
    penalty[j]=0

print(result.count("AC"),sum(penalty))

n, m = map(int, input().split())
p_s = [ list(map(str, input().split())) for _ in range(m) ]
ac = [False] * n
wa = [0] * n
for p, s in p_s:
    if ac[int(p)-1] is False:
        if s == 'AC':
            ac[int(p)-1] = True
        else:
            wa[int(p)-1] += 1
print(sum([1 for i in ac if i == True ]), sum([i for i,j in zip(wa,ac) if j == True ]))

import numpy as np
N,M=map(int,input().split())
flag=[False]*(N+1)
ac=0
wa=[0]*(N+1)
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if flag[p]==False:
        if s=='AC':
            flag[p]=True
        else:
            wa[p]+=1
print(sum(np.array(flag)),sum(np.array(wa)*np.array(flag)))

n, m = map(int, input().split())

lst = [ [i for i in input().split() ] for j in range(m) ]

ac = {}
wa = {}
visited = []
for d in lst:
  if d[0] in ac.keys():
    continue
  if d[1] == "AC":
    if d[0] not in ac.keys():
      ac[d[0]] = 1
  else:
    if d[0] in wa.keys():
      wa[d[0]] += 1
    else:
      wa[d[0]] = 1

ac_count = 0
wa_count = 0

for d in ac.keys():
  ac_count += 1
  if d in wa.keys():
    wa_count += int(wa[d])
print(ac_count,wa_count)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls, wa_cnt = [0] * N, 0

for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

N, M = map(int, input().split())
A = [0]*(N+1)
W = A.copy()
for _ in range(M):
    P, S = input().split()
    p = int(P)
    if S == "AC":
        A[p] = 1
    elif A[p] == 0:
        W[p] += 1

print(sum(A), sum(a*w for a, w in zip(A, W)))

from collections import defaultdict as dc
n, m = [int(i) for i in input().split()]
cq_dic = {}
wa_dic = dc(int)
for _ in range(m):
  p, w = input().split()
  if w == 'AC':
    cq_dic[p] = 1
  elif (not p in cq_dic) and  w == 'WA':
    wa_dic[p] += 1
ans = sum([wa_dic[k] for k in cq_dic])
print(len(cq_dic), ans)

n,m = map(int,input().split())
AC = [0]*n
WA = [0]*n
ans = 0
for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if s == "AC" and AC[p] == 0:
        AC[p] = 1
        ans += WA[p]
    WA[p] += 1
print(sum(AC),ans)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls, wa_cnt = [ 0 for i in range(N) ], 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [0] * N
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

N,M=map(int,input().split())
x=[0]*N
y=[0]*N
P=[]
s=[]

for i in range(M):
    p,S=map(str,input().split())
    P.append(int(p))
    s.append(S)
for j in range(M-1,-1,-1):
    if s[j]=='AC':
        if x[P[j]-1]==0:
            x[P[j]-1]=1
        else:
            y[P[j]-1]=0
    elif s[j]=='WA':
        if x[P[j]-1]==1:
            y[P[j]-1]+=1
print(x.count(1),sum(y))

n,m = map(int,input().split())
l = [0]*n
wcount = 0
acount = 0
for i in range(m):
  A,B = input().split()
  a = int(A)
  b = str(B)
  if l[a-1] != -1 and b =="WA":
    l[a-1] += 1
  elif l[a-1] != -1 and b =="AC":
    acount += 1
    wcount += l[a-1]
    l[a-1] = -1
print(acount,wcount)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls, wa_cnt = [0] * N, 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(idx)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    AC = defaultdict(int)
    WA = defaultdict(int)
    N, M = MI()
    wa = 0
    for i in range(M):
        p, S = input().split()

        if AC[p] == 0:
            if S == "WA":
                WA[p] +=1
            else:
                AC[p] = 1
                wa += WA[p]

    ac = sum(AC.values())
    print(ac, wa)
    
def __starting_point():
    main()
__starting_point()

def resolve():
    n,m = map(int,input().split())
    ac_list = [0]*n
    wa_count = [0]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and (ac_list[int(p)-1]==0):
            wa_count[int(p)-1] += 1
        elif s == 'AC' and (ac_list[int(p)-1]==0):
            ac += 1
            ac_list[int(p)-1] = 1
    for (i,j) in zip(wa_count,ac_list):
        if j: wa+=i
    print(f'{ac} {wa}')
resolve()

from collections import defaultdict
N, M = map(int, input().split())
wa = defaultdict(int)
ac = {}
for i in range(M):
    p, S = input().split()
    if S == 'AC':        
        ac[p] = True
    else:
        if p not in ac:
            wa[p] += 1
print(len(ac), sum([wa[x] for x in ac.keys()]))

n, m = map(int, input().split())
a = [input().split() for i in range(m)]
wa =[0]*n #ACまでのWA数
ac = [0]*n

for i in range(m):
    if a[i][1] == 'AC':
      ac[int(a[i][0])-1] = 1
    else:
      if ac[int(a[i][0])-1]==0:
        wa[int(a[i][0])-1] +=1
cnt1, cnt2= 0,0
for i in range(n):
  if ac[i] ==1:
    cnt1 += ac[i]
    cnt2 += wa[i]
        
print(cnt1, cnt2)

n,m=map(int,input().split())
ac_cnt = set()
wa_cnt = 0
penalty = [0]*n
for i in range(m):
    p,s = input().split()
    num = int(p) - 1
    if num not in ac_cnt:
        if s == "AC":
            ac_cnt.add(num)
            wa_cnt += penalty[num]
        else:
            penalty[num] += 1
print(len(set(ac_cnt)),wa_cnt)

n,m = map(int, input().split())
res = [0 for i in range(n)]
P = [0 for i in range(n)]
ans = 0
p = 0
 
for i in range(m) :
    pi, si = input().split()
    pi = int(pi) - 1
    if(res[pi]) :
        continue
    if(si == "AC") :
        res[pi] = 1
        ans += 1
        p += P[pi]
    else :
        P[pi] += 1
print(ans, p)

N,M = map(int, input().split())

AC = [0] * N
WA = [0] * N

for _ in range(M):
    p,S = input().split()
    p = int(p) - 1
    if AC[p] == 1:
        continue
    else:
        if S == 'AC':
            AC[p] = 1
        else:
            WA[p] += 1

Pen = [x*y for (x, y) in zip(AC, WA)]

print(sum(AC), sum(Pen))

n, m = map(int, input().split())
P = [0]*n
AC = 0
WA = 0
for i in range(m):
    p, S = input().split()
    p = int(p)
    if S == "AC" and P[p-1] != -1:
        WA += P[p-1]
        AC += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        P[p-1] += 1
print(AC, WA)

N,M = map(int,input().split())
 
#AC,WA
P = [0]*N
Penalty = 0
Accepted = 0
 
for i in range(M) :
    p,S = input().split()
    p = int(p)
    
    if S == "AC" and P[p-1] != -1:
        Penalty += P[p-1]
        Accepted += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        P[p-1] += 1

print(Accepted,Penalty)

N,M=map(int,input().split())
S=[0]*(N)
Q=[0]*(N)
for i in range(M):
    p,s=map(str,input().split())
    p=int(p)
    if  s=='AC':
        S[p-1]=1
    elif s=='WA' and S[p-1] ==0:
        Q[p-1]+=1
    else:
        pass
Q_com= [x * y for (x, y) in zip(S, Q)]
print (S.count(1),sum(Q_com))

import numpy as np

n,m = map(int,input().split())

ac = [0]*(n+1)
wa = [0]*(n+1)

for _ in range(m):
  p,s = map(str,input().split())
  if s == "AC" and ac[int(p)] == 0:
    ac[int(p)] = 1
  if s == "WA" and ac[int(p)] == 0:
    wa[int(p)] += 1
print(sum(ac),sum(np.array(ac)*np.array(wa)))

N,M=map(int,input().split())
prob=[[0,0] for i in range(N)]

for i in range(M):
    p,S=input().split()
    x=int(p)-1
    if prob[x][0]==0 and S=='WA':
        prob[x][1]+=1
    elif prob[x][0]==0 and S=='AC':
        prob[x][0]=1

ACs,WAs=0,0
for i in range(N):
    if prob[i][0]==1:
        ACs+=1
        WAs+=prob[i][1]

print(ACs,' ',WAs)

N, M = map(int, input().split())
ACs = [0] * (N+1)
Ps = [0] * (N+1)
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        ACs[p] = 1
    elif s == 'WA': # WA
        if ACs[p] == 0: 
            Ps[p] += 1

ans1 = sum(ACs)
ans2 = 0
for i in range(1, N+1):
    if ACs[i] == 1:
        ans2 += Ps[i]
print(ans1, ans2)

n,m = list(map(int, input().split()))
wa = [0] * (n + 1)
ac = [0] * (n + 1)
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and ac[p] == 0:
        wa[p] += 1
    elif s == 'AC':
        ac[p] = 1

for i,ok in enumerate(ac):
    if not ok:
        wa[i] = 0

print(('{} {}'.format(sum(ac), sum(wa))))



def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(map(int, input().split()))
def i_row(N): return [int(input()) for _ in range(N)]
def i_row_list(N): return [list(input().split()) for _ in range(N)]

n,m=i_map()
ps=i_row_list(m)
ac=[0]*n
wa=[0]*n
for p,s in ps:
    if s=='AC':
        ac[int(p)-1]=1
    if s=='WA':
        if ac[int(p)-1]==0:
            wa[int(p)-1]+=1
for i in range(n):
    if ac[i]==0:
        wa[i]=0
print(sum(ac),sum(wa))

n, m = map(int, input().split())
ans = [0, 0]
ac = [0 for _ in range(n)]
for _ in range(m):
  p, s = input().split()
  p = int(p) - 1
  if ac[p] == -1:
    continue
  elif s == "AC":
    ans[0] += 1
    ans[1] += ac[p]
    ac[p] = -1
  else:
    ac[p] += 1
print(*ans)

import numpy as np
n,m=map(int,input().split())
a=np.array([list(input().split()) for i in range(m)])
b=[0]*n
e=[0]*n
c=0
d=0
for i in a:
    if b[int(i[0])-1]==0:
        if i[1]=="AC":
            c+=1
            b[int(i[0])-1]=1
            d+=e[int(i[0])-1]
        else:
            e[int(i[0])-1]+=1
print(c,d)

N,M=map(int, input().split())
ACList=[0]*(N+1)
ansAC=0
ansP=0
for i in range(M):
	p,S=map(str, input().split())
	p=int(p)
	if S=="AC" and ACList[p]!=-1:
		ansAC+=1
		ansP+=ACList[p]
		ACList[p]=-1
	elif S=="WA" and ACList[p]!=-1:
		ACList[p]+=1
	else:
		continue

print(ansAC,ansP)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]

for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

n, m = map(int, input().split())
answer = 0
penalty = 0
ans = [0] * n
pen = [0] * n
 
for x in range(m):
  p, s = input().split()
  pi = int(p) - 1
  if ans[pi] == 1:
    continue
 
  if s == 'AC':
    answer += 1
    ans[pi] = 1
    penalty += pen[pi]
  elif s == 'WA':
    pen[pi] += 1
 
print(f'{answer} {penalty}')