AtCoder Beginner Contest 141
翻译中…
Problem Statement
翻译中…
Takahashi will do a tap dance. The dance is described by a string $S$ where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.
翻译中…
$S$ is said to be easily playable if and only if it satisfies both of the following conditions:
翻译中…
- Every character in an odd position (
$1$-st,$3$-rd,$5$-th,$\ldots$) isR,U, orD. - Every character in an even position (
$2$-nd,$4$-th,$6$-th,$\ldots$) isL,U, orD.
翻译中…
Your task is to print Yes if $S$ is easily playable, and No otherwise.
翻译中…
Constraints
翻译中…
$S$is a string of length between$1$and$100$(inclusive).- Each character of
$S$isL,R,U, orD.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
S
翻译中…
Output
翻译中…
Print Yes if $S$ is easily playable, and No otherwise.
翻译中…
样例
Input #1
RUDLUDR
Output #1
Yes
Every character in an odd position ($1$-st, $3$-rd, $5$-th, $7$-th) is `R`, `U`, or `D`.
Every character in an even position ($2$-nd, $4$-th, $6$-th) is `L`, `U`, or `D`.
Thus, $S$ is easily playable.
Input #2
DULL
Output #2
No
The $3$-rd character is not `R`, `U`, nor `D`, so $S$ is not easily playable.
Input #3
UUUUUUUUUUUUUUU
Output #3
Yes
Input #4
ULURU
Output #4
No
Input #5
RDULULDURURLRDULRLR
Output #5
Yes
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。