B - Tap Dance Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点: 200

問題文

高橋君はタップダンスをすることにしました。タップダンスの動きは文字列 S で表され、S の各文字は L, R, U, D のいずれかです。各文字は足を置く位置を表しており、1 文字目から順番に踏んでいきます。

S が以下の 2 条件を満たすとき、またその時に限り、S を「踏みやすい」文字列といいます。

  • 奇数文字目がすべて R, U, D のいずれか。
  • 偶数文字目がすべて L, U, D のいずれか。

S が「踏みやすい」文字列なら Yes を、そうでなければ No を出力してください。

制約

  • S は長さ 1 以上 100 以下の文字列
  • S の各文字は L, R, U, D のいずれか

入力

入力は以下の形式で標準入力から与えられます。

S

出力

S が「踏みやすい」文字列なら Yes を、そうでなければ No を出力してください。


入力例 1

RUDLUDR

出力例 1

Yes

1, 3, 5, 7 文字目は R, U, D のいずれかです。

2, 4, 6 文字目は L, U, D のいずれかです。

したがって、この S は「踏みやすい」文字列です。


入力例 2

DULL

出力例 2

No

3 文字目が R, U, D のいずれでもないので、この S は「踏みやすい」文字列ではありません。


入力例 3

UUUUUUUUUUUUUUU

出力例 3

Yes

入力例 4

ULURU

出力例 4

No

入力例 5

RDULULDURURLRDULRLR

出力例 5

Yes

Score: 200 points

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) is R, U, or D.
  • Every character in an even position (2-nd, 4-th, 6-th, \ldots) is L, U, or D.

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 is L, R, U, or D.

Input

Input is given from Standard Input in the following format:

S

Output

Print Yes if S is easily playable, and No otherwise.


Sample Input 1

RUDLUDR

Sample 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.


Sample Input 2

DULL

Sample Output 2

No

The 3-rd character is not R, U, nor D, so S is not easily playable.


Sample Input 3

UUUUUUUUUUUUUUU

Sample Output 3

Yes

Sample Input 4

ULURU

Sample Output 4

No

Sample Input 5

RDULULDURURLRDULRLR

Sample Output 5

Yes