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# (Mono 4.6.2.0) (judge verdict: Accepted)

/*********************************************
* c# template
*20.06.13 AtCoder Beginner Contest 151. C, D (c#)
*********************************************/

namespace TempName{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Text;
    using static System.Console;
    using static IOmacro._CSharpInput; 
    using static IOmacro._CppInput;
    
    public class _CRun{
        public readonly int PROBLEM_NUM = 1;

/*********************************************
20.06.13 AtCoder Beginner Contest 151. C - Welcome to AtCoder
N問の問題がある
M回の提出で、正解数とペナルティは？

test input :
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
*********************************************/            
        public void solve1()
        {
            int numProb = cin;
            int numQry = cin;
            
            var arrCntWA = new int[numProb + 1];
            
            int cntAC = 0;
            int cntWA = 0;
            
            while (numQry-- > 0) {
                int inNum = cin;
                string inStr = cin;
                
                if (arrCntWA[inNum] == -1) {
                    continue;
                }
                else if (inStr == "AC") {
                    cntAC += 1;
                    cntWA += arrCntWA[inNum];
                    arrCntWA[inNum] = -1;
                }
                else {
                    arrCntWA[inNum] += 1;
                }
            }
            
            WriteLine($"{cntAC} {cntWA}");
        }

/*********************************************
20.06.13 AtCoder Beginner Contest 151. D - Maze Master

壁と通路が存在する２次元の迷路がある。
出発点と到着点を任意設定できるとき、
最大移動距離は？
*********************************************/            
        public void solve2()
        {
            
        }

/*********************************************

*********************************************/            
        public void solve3()
        {
            
        }

/*********************************************

*********************************************/            
        public void solve4()
        {
            
        }

/*********************************************

*********************************************/            
        public void solve5()
        {
            
        }

/*********************************************

*********************************************/            
        public void solve6()
        {
            
        }
    }

    class Program { 
        static void Main() { 
            var run = new _CRun();
            switch (run.PROBLEM_NUM) {
                case 1: run.solve1(); break;
                case 2: run.solve2(); break;
                case 3: run.solve3(); break;
                case 4: run.solve4(); break;
                case 5: run.solve5(); break;
                case 6: run.solve6(); break;
            }
        } 
    }
}

namespace IOmacro {
    //20.05.10. 수정
    
    using System; 
    using System.Linq; 
    using System.IO;
    using System.Collections.Generic;
    
    public class _CSharpInput {
        public static StreamWriter _writer = new StreamWriter(Console.OpenStandardOutput());
        public const char separator = ' ';
        public static string _string{get{return Console.ReadLine();}}
        public static string[] _stringa{get{return (Console.ReadLine().Split(separator));}}
        public static int _int{get{return int.Parse(Console.ReadLine());}}
        public static int[] _inta{get{return Console.ReadLine().Split(separator).Select(int.Parse).ToArray();}}
        public static long _long{get{return long.Parse(Console.ReadLine());}}
        public static long[] _longa{get{return Console.ReadLine().Split(separator).Select(long.Parse).ToArray();}}    
        public static double _double{get{return double.Parse(Console.ReadLine());}}
        public static double[] _doublea{get{return Console.ReadLine().Split(separator).Select(double.Parse).ToArray();}}    
    }
    
    public class _CppInput {
        public static _CppInput cin => new _CppInput();
        public const char separator = ' ';
        private static readonly Queue<string> _input = new Queue<string>();
        private _CppInput(){}
        public static implicit operator string(_CppInput _) {
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return _input.Dequeue();
        }
        public static implicit operator int(_CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return int.Parse(_input.Dequeue());
        }
        public static implicit operator long(_CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return long.Parse(_input.Dequeue());
        }
        public static implicit operator double(_CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return double.Parse(_input.Dequeue());
        }
    }
    
    public static class _CEnumerableExtension {
        public delegate void Function<in T>(T val);
        public static void foreachExtension<T>(this IEnumerable<T> enumerable, Function<T> function) {
            foreach (var x in enumerable) function(x);
        }
    }
}