Question
Maximum string
Given a string S, and an integer K your task is to find the lexicographically largest string by removing no more than K characters.
Input
The first line of input contains a single string S, and the next line of input contains a single integer K.
Constraints:-
1 <= |S| <= 105
1 <= K <= 105
Note:- String will contain only lowercase English letters.
Constraints:-
1 <= |S| <= 105
1 <= K <= 105
Note:- String will contain only lowercase English letters.
Output
Print the lexicographically largest string possible after removing not more than K characters.
Example
Sample Input 1:-
abzccd
4
Sample Output 1:-
zd
Sample Input 2:-
dcba
5
Sample Output 2:-
dcba
abzccd
4
Sample Output 1:-
zd
Sample Input 2:-
dcba
5
Sample Output 2:-
dcba