For this Question: You are given a string S of length N. Find the character which occurs the most number of times in this string. If there are mutliple such characters present, print -1.The first line of the input contains a single integer N.
The second line of the input contains a string S.

<b>Constraints:</b>
2 <b>&le;</b> N <b>&le;</b> 10<sup>5</sup>
All characters in string S are lowercase english letters.Print the character which occurs the most number of times in this string. If there are mutliple such characters present, print -1.Sample Input:
7
abadcar

Sample Output:
a, I have written this Solution Code: import java.io.*;
import java.util.*;



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


        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        int arr[]= new int[26];
        for(int i=0;i<n;i++){
            char ch = s.charAt(i);
            int j = ch - 'a';
            arr[j]++;
        }
        int max = 0;
        int sec = 0;
        int fr = 0;
        int j =0;

        for(int i=0;i<26; i++){
            if(arr[i]> max){
                sec = max;
                max = arr[i];
                j=i;
            }else if(arr[i]>sec){
                sec = arr[i];
            }
        }

        if(sec == max){
            System.out.print(-1);
        }else{
            for(int i=0;i<n; i++){
                char c = s.charAt(i);
                if(c-'a' == j){
                    System.out.print(c);
                    break;
                }
            }
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?