For this Question: Given a string S consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters separately such that if the ith place in the original string had an uppercase character then it should not have a lowercase character after being sorted and vice versa.The first line contains a single integer N denoting the length of the string. The second line contains a string S of length N, consisting of uppercase and lowercase characters.

1 <= N <= 100000Print a single integer containing the sorted string.Sample Input:
Valak

Sample Output:
Vaakl

Sample Input:
mwYifAbSQV

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



class Main {
	public static String caseSort(String str) {

		StringBuilder sb = new StringBuilder(str);

		int lower[] = new int[26];
		int upper[] = new int[26];

		for(int i=0; i<str.length(); i++) {
			if(Character.isLowerCase(str.charAt(i))) {
				lower[str.charAt(i) - 'a']++;
			}
			else {
				upper[str.charAt(i) - 'A']++;
			}
		}

		int j = 0;
		int k = 0;

		while(j<26 && lower[j] == 0) {
			j++;
		}

		while(k<26 && upper[k] == 0) {
			k++;
		}

		for(int i=0; i<str.length(); i++) {
			if(Character.isLowerCase(str.charAt(i))) {
				while(lower[j] == 0) {
					j++;
				}

				sb.setCharAt(i,(char)(j + 'a'));
				lower[j]--;
			}
			else {
				while(upper[k] == 0) {
					k++;
				}

				sb.setCharAt(i,(char)(k + 'A'));

				upper[k]--;
			}
		}

		return sb.toString();
	}


	public static void main (String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();

		System.out.println(caseSort(str));
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?