Problem:
Score : 200 points

Problem Statement

Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.

The problem has N test cases.

For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.

See the Output section for the output format.

Constraints

1 \leq N \leq 10^5

S_i is AC, WA, TLE, or RE.

Input

Input is given from Standard Input in the following format:

N
S_1
\vdots
S_N

Output

Let C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:

AC x C_0
WA x C_1
TLE x C_2
RE x C_3

Sample Input 1

6
AC
TLE
AC
AC
WA
TLE

Sample Output 1

AC x 3
WA x 1
TLE x 2
RE x 0

We have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.

Sample Input 2

10
AC
AC
AC
AC
AC
AC
AC
AC
AC
AC

Sample Output 2

AC x 10
WA x 0
TLE x 0
RE x 0

Solution in Java (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final int MAX = (int)1e6;
    private static boolean isPrime[];
    private static final Map<Long,Long> cache =  new HashMap<>();

    public static void main(String[] args) throws Exception{
        Map<String,Integer> map = new HashMap<>();
        map.put("AC",1);
        map.put("WA",2);
        map.put("TLE",3);
        map.put("RE",4);
        int n = readInt();
        int arr[] = new int[5];
        for(int i=0;i<n;i++){
            String word  =readLine();
            word = word.trim();
            arr[map.get(word)]++;
        }
        System.out.println("AC x "+arr[1]);
        System.out.println("WA x "+arr[2]);
        System.out.println("TLE x "+arr[3]);
        System.out.println("RE x "+arr[4]);
    }


    private static long power(long base,int exp){
        if(exp==0)
            return 1L;
        if(base==1 || exp==1)
            return base;
        long part = power(base,exp/2);
        part*=part;
        if(exp%2==1)
            part*=base;
        return part;
    }

    private static int powerOf(long num,int prime){
        int curr =0;
        while(num%prime==0){
            num/=prime;
            curr++;
        }
        return curr;
    }


    private static List<Integer> preprocessPrimes(int limit){
        isPrime = new boolean[limit+1];
        List<Integer> primes = new ArrayList<>();
        Arrays.fill(isPrime,true);
        isPrime[0] = isPrime[1] = false;
        int sqrt = (int)Math.sqrt(limit);
        for(int i=2;i<=sqrt;){
            for(int j=i*i;j<=limit;j+=i){
                isPrime[j] = false;
            }
            i++;
            while(i<=sqrt && !isPrime[i])
                i++;
        }
        for(int i=2;i<=limit;i++){
            if(isPrime[i])
                primes.add(i);
        }
        return primes;
    }

    private static int pow(int base,int exp,int MOD){
        if(exp==0)
            return 1;
        if(base==1 || exp==1)
            return base%MOD;
        int part = pow(base,exp/2,MOD);
        part*=part;
        part%=MOD;
        if(exp%2==1){
            part*=base;
            part%=MOD;
        }
        return part;
    }

    private static long pow(long base,long exp,long MOD){
        if(exp==0)
            return 1;
        if(base==1 || exp==1)
            return base%MOD;
        long part = pow(base,exp/2,MOD);
        part*=part;
        part%=MOD;
        if(exp%2==1){
            part*=base;
            part%=MOD;
        }
        return part;
    }

    private static int gcd(int max,int min){
        if(min==0){
            return max;
        }
        return gcd(min,max%min);
    }

    private static long gcd(long max,long min){
        if(min==0){
            return max;
        }
        return gcd(min,max%min);
    }

    private static int lcm(int max,int min){
        int gcd = gcd(max,min);
        return (max/gcd)*min;
    }

    private static long lcm(long max,long min){
        long gcd = gcd(max,min);
        return (max/gcd)*min;
    }

    private static int gcd(int[] nums){
        int gcd = nums[0];
        for(int i=1;i<nums.length;i++){
            gcd = gcd(Math.max(gcd,nums[i]),Math.min(gcd,nums[i]));
        }
        return gcd;
    }

    private static long gcd(long[] nums){
        long gcd = nums[0];
        for(int i=1;i<nums.length;i++){
            gcd = gcd(Math.max(gcd,nums[i]),Math.min(gcd,nums[i]));
        }
        return gcd;
    }

    private static int lcm(int[] nums){
        if(nums.length<2)
            return nums[0];
        int lcm = lcm(Math.max(nums[0],nums[1]),Math.min(nums[0],nums[1]));
        for(int i=2;i<nums.length;i++){
            lcm = lcm(lcm,nums[i]);
        }
        return lcm;
    }

    private static long lcm(long[] nums){
        if(nums.length<2)
            return nums[0];
        long lcm = lcm(Math.max(nums[0],nums[1]),Math.min(nums[0],nums[1]));
        for(int i=2;i<nums.length;i++){
            lcm = lcm(lcm,nums[i]);
        }
        return lcm;
    }

    public static int readInt() throws Exception{
        return Integer.parseInt(br.readLine());
    }
    public static long readLong() throws Exception {
        return Long.parseLong(br.readLine());
    }
    public static double readDouble() throws Exception {
        return Double.parseDouble(br.readLine());
    }
    public static String readLine() throws Exception{
        return br.readLine();
    }
    public static int[] readIntArray() throws Exception{
        String[] tokens = br.readLine().split(" ");
        int[] nums = new int[tokens.length];
        for(int i=0;i<tokens.length;i++){
            nums[i] = Integer.parseInt(tokens[i]);
        }
        return nums;
    }
    public static long[] readLongArray() throws Exception{
        String[] tokens = br.readLine().split(" ");
        long[] nums = new long[tokens.length];
        for(int i=0;i<tokens.length;i++){
            nums[i] = Long.parseLong(tokens[i]);
        }
        return nums;
    }
    public static double[] readDoubleArray() throws Exception {
        String[] tokens = br.readLine().split(" ");
        double[] nums = new double[tokens.length];
        for(int i=0;i<tokens.length;i++){
            nums[i] = Double.parseDouble(tokens[i]);
        }
        return nums;
    }
    public static String[] readWords() throws Exception {
        return br.readLine().split(" ");
    }
}