14728 - Word Puzzle   

Description

You are given a source string $S$, an integer $k$, and a target string $T$.

Determine whether there exists a contiguous substring of S with length $k$ whose characters can be rearranged to form $T$, you can left some characters unused.

If such a window exists, print YES; otherwise, print NO.

Input

  • Line 1: the source string $S$
  • Line 2: the integer $k$
  • Line 3: the target string $T$

Constraints

  • $1 \leq \lvert S \rvert, \lvert T \rvert \leq 2 \times 10^5$
  • $0 \leq k \leq 2 \times 10^5$

Subtask

For testcases 1~5:

  • $1 \leq \lvert S \rvert, \lvert T \rvert \leq 1000$
  • $0 \leq k \leq 1000$

For testcases 6~10:

  • No additional constraints.

Output

Print YES if there exists a contiguous substring of $S$ with length $k$ whose characters can be rearranged to form $T$ (possibly with extra unused characters in the window).

Otherwise, print NO.

Sample Input  Download

Sample Output  Download




Discuss