Jini is solving one problem. She is given a string and number k. Her task is to find k’th non-repeating character in the string while traversing string from left to right. Help Jini to solve this problem.
Input Format :
First line contains string and second line contains integer k.
Output Format :
Print the k’th non repeating character in the string if it exists or if it does not exist then print -1.
Constraints :
1<= string length <= 10^6
1<=k<=26
In first input, as we traverse in the string, 'h' , 'c' , 'e' , 'n' are the 1st, 2nd, 3rd, 4th non-repeating characters respectively. So 'c' is the 2nd non-repeating character.