Problem:
Score : 300 points

Problem Statement

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 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

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.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
 
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
 
#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)
 
typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)
 
#define S_RTN(S)  s_cout(S);return 0
 
 
#define _itoa(A,N) sprintf(A, "%d", N);
 
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
 
int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
 
 
int s_asorts(const void* a, const void* b);
 
//昇順
int s_asorts(const void* a, const void* b) {
    return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
    return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
    return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
    int i;
    rept(i, 0, n) {
        l_cin2(*(a + i), *(b + i));
    }
    return 0;
}
int i_cins(int n, int* a) {
    int i;
    for (i = 0; i < n; i++) {
        i_cin(*(a + i));
    }
 
    return 0;
}
int _gcd(int a, int b) {
    int r, tmp;
    if (a < b) { tmp = a; a = b; b = tmp; }
    r = a % b;
    while (r) {
        if (!r) break;
        a = b; b = r;
        r = a % b;
    }
    return(b);
}
 
long _max(long a, long b) {
    return a > b ? a : b;
}
long _min(long a, long b) {
    return a < b ? a : b;
}
int _swp(int* a, int* b)
{
    int tmp;
    tmp = *b; *b = *a; *a = tmp;
    return 0;
}

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main(){
    ll N,K;
    scanf("%lld %lld",&N,&K);
    ll wa[N+1];
    ll ac[N+1];
    ll cntw=0;
    ll cnta=0;
    rept(i,0,K){
        ll t=0;
        char b[3];
        scanf("%lld",&t);
        scanf("%s",b);
        if(strcmp("WA",b)==0 && wa[t] != -1){
            cntw++;
        }else if(strcmp("AC",b)==0 && ac[t] != -1){
            cnta++;
            ac[t]=-1;
            wa[t]=-1;
        }
        
    }
    
    printf("%lld %lld",cnta,cntw);
    
}