시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 1024 MB 2 0 0 0.000%

문제

Playing games is fun. For programmers, however, playing games with programs is even more fun. Consider a simple single-user tabletop game as follows. Given a row of sticks, each of which is in one of the seven colors, red (R), green (G), blue (B), cyan (C), magenta (M), yellow (Y), and key (K), the goal of the game is to eliminate all the sticks by repeating the following rules.

  • Consecutive sticks with the same color can be eliminated if the size of them is not less than m.
  • The remaining sticks will move closer together.

For the case where the row is BBBRRRRRRGGGB and m is 3, all the sticks can be successfully eliminated as the following steps:

  1. BBBRRRRRRGGGB
  2. BBBGGGB (By eliminating all red sticks)
  3. BBBB (By eliminating all green sticks)
  4. (By eliminating all blue sticks)

For the same row of sticks with m = 4, however, it is no way to eliminate all the sticks.

Given a row of n sticks and the value of m, your task is to determine if it is possible to eliminate all the sticks.

입력

Each test case is given as a string that is the row of sticks and an integer m.

출력

Output Yes if it is possible to eliminate all the sticks. Otherwise, output No.

제한

  • 0 < n, m ≤ 500

예제 입력 1

BBBRRRRRRGGGB 3

예제 출력 1

Yes

예제 입력 2

BBBRRRRRRGGGB 4

예제 출력 2

No