Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):

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

#print(N,M)

num=[]
answer=[]
correct=[False] * N
correctCount = 0
wrongCount = 0
wrong=[False] * N
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[n] == False:
            correct[n] = True
            correctCount += 1
            wrongCount += wrong[n]
    else:
        if correct[n] == False:
            wrong[n] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)
    





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

#print(N,M)

num=[]
answer=[]
correct=[False] * N
correctCount = 0
wrongCount = 0
wrong=[0] * N
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[int(n)] == False:
            correct[int(n)] = True
            correctCount += 1
            wrongCount += wrong[int(n)]
    else:
        if correct[int(n)] == False:
            wrong[int(n)] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)

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

#print(N,M)

num=[]
answer=[]
correct=[False] * N
correctCount = 0
wrongCount = 0
wrong[False] * N
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[n] == False:
            correct[n] = True
            correctCount += 1
            wrongCount += wrong[n]
    else:
        if correct[n] == False:
            wrong[n] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)
    





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

#print(N,M)

num=[]
answer=[]
correct=[False] * N
correctCount = 0
wrongCount = 0
wrong=[0] * N
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[n] == False:
            correct[n] = True
            correctCount += 1
            wrongCount += wrong[n]
    else:
        if correct[n] == False:
            wrong[n] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)
    





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

#print(N,M)

num=[]
answer=[]
correct=[False] * (N+1)
correctCount = 0
wrongCount = 0
wrong=[0] * (N+1)
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[int(n)] == False:
            correct[int(n)] = True
            correctCount += 1
            wrongCount += wrong[int(n)]
    else:
        if correct[int(n)] == False:
            wrong[int(n)] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)
    



Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted