Nathan Coulas

CCC '14 J2 - Vote Count

ccc14j2 JAVA8 05 Nov, 2019 1.328s 3 points

Source Code

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        String b = in.next();
        int count = 0;
        
        for(int i = 0; i < a; i++){
            if(b.charAt(i) == 'A'){
                count++;
            }
        }
        
        
        if(count > a - count){
            System.out.println("A");
        }else if(a - count > count){
            System.out.println("B");
        }else if((a - count) == count){
            System.out.println("Tie");
        }

    }
}