#K11606. Substring Existence Checker
Substring Existence Checker
Substring Existence Checker
You are given a string S consisting of lowercase English letters and an integer K. Your task is to determine whether there exists a substring of S with length exactly K that contains at least \( \lfloor \frac{K}{2} \rfloor \) different characters.
For example, if S = "abacab" and K = 4, one valid substring is "abac", which contains 3 distinct characters. Since \(\lfloor 4/2 \rfloor = 2\) and 3 \(\ge\) 2, the answer would be "Yes". Otherwise, output "No" if no such substring exists.
Note: The comparison uses integer division for \(K/2\), i.e. \(\lfloor K/2 \rfloor\).
inputFormat
The input is provided via standard input in the following format:
S K
Where S is a non-empty string of lowercase English letters, and K is an integer representing the required substring length.
outputFormat
Output a single line to standard output containing either "Yes" if there exists a substring of length K with at least \(\lfloor K/2 \rfloor\) different characters, or "No" otherwise.
## sampleabacab
4
Yes