#abc297b. [abc297_b]chess960
[abc297_b]chess960
Problem Statement
Takahashi is playing a game called Chess960. He has decided to write a code that determines if a random initial state satisfies the conditions of Chess960.
You are given a string of length eight. has exactly one K
and Q
, and exactly two R
's, B
's , and N
's. Determine if satisfies all of the following conditions.
-
Suppose that the -th and -th characters from the left of are
B
; then, and have different parities. -
K
is between twoR
's. More formally, suppose that the -th and -th characters from the left of areR
and the -th isK
; then .
Constraints
- is a string of length that contains exactly one
K
andQ
, and exactly twoR
's,B
's , andN
's.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if satisfies the conditions; print No
otherwise.
Sample Input 1
RNBQKBNR
Sample Output 1
Yes
The -rd and -th characters are B
, and and have different parities. Also, K
is between the two R
's. Thus, the conditions are fulfilled.
Sample Input 2
KRRBBNNQ
Sample Output 2
No
K
is not between the two R
's.
Sample Input 3
BRKRBQNN
Sample Output 3
No