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 (Clang 3.8.0) (judge verdict: Wrong Answer)

// Twitter@KonoLv1 2020年春からエンジニア見習いデビュー！
 
//  標準入出力を扱うヘッダーファイルの読み込み
#include <stdio.h>
//  "atoi" "atof"などのキャスト、"rand" 疑似乱数を発生させるヘッダーファイルの読み込み
#include <stdlib.h>
//  "strcpy" "strcat"などの文字列操作や"strlen"文字列長さ取得などを行うヘッダーファイルの読み込み
#include <string.h>
//  "sqrtl" "fmax"などの数値操作を行うヘッダーファイルの読み込み
#include <math.h>

void global_box_sort_desc(void);
void global_box_sort_asc(void);

int global_box[256];
 
int main(void){
  //  char text[256];
//    int no[256];
  //  int yuukoudo[500][500];
    char s[256] = {};
    int ok[100000] = {};
    int x,y,z;
    int i,j;
    int pi;
    int n,m;
    int ng[100000] = {};
    int flg = 0;
    int ngcount = 0;
    int count = 0;
    scanf("%d %d",&n,&m);
    for (i = 0; i < m; i++){
       scanf("%d %s",&pi,s);
       if (s[0] == 'A'){
           ok[pi] = ok[pi] + 1;
           if (ok[pi] == 1){
                ngcount = ngcount + ng[pi]; 
           }
       }else{
           if (ok[pi] == 0){
               ng[pi] = ng[pi] +1;
           }
       }
    }
    for (i = 0; i <= n; i++){
        if (ok[i] >= 1){
            count++;
        }
    }
    printf("%d %d",count,ngcount);
   
}



void global_box_sort_desc (void){
    int tmp = 0;int i,j;int n;
    
    scanf("%d",&n);
    
    for (i = 0; i < n; i++){
        scanf("%d",&global_box[i]);
    }
    for (i = 0; i < n - 1; i++){
        for (j = i + 1; j < n; j++){
            if (global_box[i] >= global_box[j]){
                tmp = global_box[i];
                global_box[i] = global_box[j];
                global_box[j] = tmp;
            }
        }
    }
    for (i = 0; i < n; i++){
        printf("%d\n",global_box[i]);
    }
}

void global_box_sort_asc (void){
    int tmp = 0;int i,j;int n;
    
    scanf("%d",&n);
    
    for (i = 0; i < n; i++){
        scanf("%d",&global_box[i]);
    }
    for (i = 0; i < n - 1; i++){
        for (j = i + 1; j < n; j++){
            if (global_box[i] <= global_box[j]){
                tmp = global_box[i];
                global_box[i] = global_box[j];
                global_box[j] = tmp;
            }
        }
    }
    for (i = 0; i < n; i++){
        printf("%d\n",global_box[i]);
    }
}