传统题 1000ms 256MiB

chess960

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Background

You are given a string S of length eight. S has exactly one K and Q, and exactly two R's, B's , and N's. Determine if S satisfies all of the following conditions.

  • Suppose that the x-th and y-th (x<y) characters from the left of S are B; then, x and y have different parities.
  • K is between two R's. More formally, suppose that the x-th and y-th (x<y) characters from the left of S are R and the z-th is K; then x<z<y.

Description

one string S

  • S is a string of length 88 that contains exactly one K and Q, and exactly two R's, B's , and N's..

Input

one string S

  • S is a string of length 8 that contains exactly one K and Q, and exactly two R's, B's , and N's..

Output

"Yes"or"No".

Samples

RNBQKBNR
Yes
KRRBBNNQ
No
BRKRBQNN
No

For the first sample:The 3-rd and 6-th characters are B, and 3 and 6 have different parities. Also, K is between the two R's. Thus, the conditions are fulfilled.

For the second sample:K is not between the two R's.

Limitation

2s, 1024MB for each test case.

hncpc积分选拔赛

未参加
状态
已结束
规则
ACM/ICPC
题目
5
开始于
2023-8-22 14:00
结束于
2023-8-22 17:00
持续时间
3 小时
主持人
参赛人数
32