Problem:
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

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.util.*;

class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        //タップダンスの動きを取得する
        String allStep = sc.next();
        //1文字ずつに分解する
        String[] stepArray = allStep.split("");
        
        
        //踏みやすいステップかどうかのフラグを設定する
        boolean easyStepFlg = true;
        
        //結果出力用の文字列を定義する
        String result = "";
        
        //踏みやすいかどうかを判定する
        for(int i = 0; i < stepArray.length; i++) {

          	//奇数偶数で分岐する文字判定ロジック
            if(i % 2 == 0) {
            // 奇数文字目：L以外なら踏みやすい
            // リストとしては0番目から始まるため、iが偶数の場合となる
                if(stepArray[i].equals("L")) {
                    easyStepFlg = false;
                }
            } else if (i % 2 == 1) {
            // 偶数文字目：R以外なら踏みやすい（iが奇数の場合を判定する）
                if(stepArray[i].equals("R")) {
                    easyStepFlg = false;
                }
            } else {
                //普通はここに入らないが念の為falseにしておく
                easyStepFlg = false;
            }
            
            //L,R,U,Dのいずれでもない場合は踏みにくいためfalseとする
            if(!(stepArray[i].equals("L") || stepArray[i].equals("R") || stepArray[i].equals("U") || stepArray[i].equals("D"))) {
                easyStepFlg = false;
            }
            
            //踏みやすいかどうかフラグがfalseになったらfor文を抜けて処理を終わらせる
            if(!easyStepFlg) {
                break;                
            }
        }
        
        //for文を最後まで回して踏みやすいフラグがtrueのままならYes、ダメな場合はNoを結果に詰める
        if(easyStepFlg) {
            result = "Yes";
        } else {
            result = "No";
        }

        //判定の結果を出力する
        System.out.println(result);
    }    
}