#C11893. K-th Largest Distinct Character
K-th Largest Distinct Character
K-th Largest Distinct Character
Given a string \(s\) consisting of lowercase English letters and an integer \(k\), determine the \(k\)-th largest distinct character in \(s\) according to alphabetical order (i.e., 'a' is the smallest and 'z' the largest). If the string does not contain at least \(k\) distinct characters, output a question mark, \(\texttt{?}\).
Example: For \(s = \texttt{abracadabra}\) and \(k = 2\), the distinct characters sorted in increasing order are: \(a, b, c, d, r\). The 2nd largest distinct character is \(d\), so the output is \(d\).
inputFormat
The input is given via standard input (stdin) in two lines. The first line contains the string \(s\) (only lowercase letters). The second line contains an integer \(k\).
outputFormat
The output should be a single line to standard output (stdout) containing the \(k\)-th largest distinct character. If there are fewer than \(k\) distinct characters in \(s\), output \(\texttt{?}\).
## sampleabracadabra
2
d