Solution for CCC '11 S1 - English or French? in Java 8


Dec. 4, 2019 2.399831 seconds Java 8
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
                Scanner in = new Scanner(System.in);
        char letter;
        int tCount = 0;
        int sCount = 0;
        int numOfLines = in.nextInt();
        String main = "";
        in.nextLine();
        
        for(int i = 0; i < numOfLines; i++){
            main += in.nextLine();
        } 
        main = main.toLowerCase();
        for(int i = 0; i < main.length(); i++){
            letter = main.charAt(i);
            if(letter == 't'){
                tCount++;
            }else if(letter == 's'){
                sCount++;
            }
        
        }
        if(tCount > sCount){
            System.out.println("English");
        }else{
        System.out.println("French");
        }
 
    }
  
    
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.