AtCoder Beginner Contest 151
C
Welcome to AtCoder
AtCoder
⌀ 327
原题
← BD →
翻译中…

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.

翻译中…

样例

Input #1
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
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.
Input #2
100000 3
7777 AC
7777 AC
7777 AC
Output #2
1 0
Note that it is pointless to get an `AC` more than once on the same problem.
Input #3
6 0
Output #3
0 0
题目信息
题号
abc151_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。