For this Question: Given a string S, and an integer K your task is to find the lexicographically largest string by removing no more than K characters.The first line of input contains a single string S, and the next line of input contains a single integer K.

<b>Constraints:-</b>
1 <= |S| <= 10<sup>5</sup>
1 <= K <= 10<sup>5</sup>

Note:- String will contain only lowercase English letters.Print the lexicographically largest string possible after removing not more than K characters.Sample Input 1:-
abzccd
4

Sample Output 1:-
zd

Sample Input 2:-
dcba
5

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



class Main {
    public static void main (String[] args) {
        Scanner inp = new Scanner(System.in);
        String str = inp.nextLine();
        int n = inp.nextInt();

        Stack<Character> st = new Stack<>();
        int check = 0;
        for(int i = 0 ; i < str.length() ; i++){
            if(n > 0){
                while(!st.isEmpty() && n > 0 && str.charAt(i) > st.peek()){
                    st.pop();
                    n--;
                }
                st.push(str.charAt(i));
                check++;
            }
            else
                continue;
        }
        String ans = "";
        while(!st.isEmpty()){
            ans = st.pop() + ans;
        }
        if(check < str.length()){
            ans += str.substring(check, str.length());
        }
        System.out.println(ans);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?