题目描述
Problem Description
Residents of Takahashi City love puns, and a high level of punning ability is required to navigate the city well.
It is customary in Takahashi City for residents to shower newcomers with various puns when they move in. Recently, a type of pun called "Anagram DaJare" has become popular. "Anagram DaJare" refers to a situation where, within a sentence, there are two strings of the same length that do not share any common parts, and rearranging the characters of one string results in the other string. When the length of such strings is $ m $, we say that the sentence contains an "Anagram DaJare" of length $ m $.
For example, consider the sentence "だじゃれをいったのはだれじゃ". The string "だじゃれ" formed by the first 4 characters and the string "だれじゃ" formed by the last 4 characters do not share any common parts, and rearranging "だじゃれ" results in "だれじゃ". Therefore, this sentence contains an "Anagram DaJare" of length 4.
Aoki, who has just moved to Takahashi City, wants to develop his ability to detect "Anagram DaJare" to navigate the city well. Aoki is particularly bad at finding "Anagram DaJare" of length $ K $, so he decided to use a text generation software for special training.
However, the text generation software does not have a function to determine whether it contains an "Anagram DaJare" of length $ K $.
You must create a program to determine whether the text contains an "Anagram DaJare" of length $ K $ for Aoki.
Input Format
The input is given from the standard input in the following format:
$ N $ $ K $ $ S $
- The first line contains the length of the given sentence $N\ (1\ ≦\ N\ ≦\ 10^5)$ and the length of the desired "Anagram DaJare" $K\ (1\ ≦\ K\ ≦\ N)$, separated by spaces.
- The second line contains the sentence to be judged. This sentence is of length $ N $ and consists only of lowercase English letters.
Output Format
If the sentence contains an "Anagram DaJare" of length $ K $, output YES. If not, output NO. End the output with a newline.
Sample Input and Output
Sample Input #1
8 3
abcdbcae
Sample Output #1
YES
Sample Input #2
7 4
abcdcba
Sample Output #2
NO
Sample Input #3
8 1
issample
Sample Output #3
YES
Notes/Hints
Partial Points
This problem has partial points.
- If you correctly solve dataset 1 with $N\ ≦\ 8$, you will be awarded 15 points.
- If you correctly solve dataset 2 with $N\ ≦\ 300$, you will be awarded an additional 15 points.
- If you correctly solve dataset 3 with $N\ ≦\ 5,000$, you will be awarded an additional 15 points.
- If you correctly solve dataset 4 without additional constraints, you will be awarded an additional 55 points.
Sample Explanation 1
The string "abc" starting from the first character and the string "bca" starting from the fifth character can be rearranged to form each other, so the sentence contains an "Anagram DaJare" of length 3.
Sample Explanation 2
The string "abcd" starting from the first character and the string "dcba" starting from the fourth character can be rearranged to form each other, but they share the fourth character, which does not meet the condition. No other extraction methods meet the condition.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分