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



Sample input:
RUDLUDR


Sample output:
Yes

Submission status: Accepted

Solution code:
S = input()
point = 0

if len(S)%2 == 0:
    for i in range(0,len(S),2):
        if S[i] in 'RUD' and S[i+1] in 'LUD':
            point += 2

if len(S)%2 == 1:
    if S[0] in 'RUD':
        point += 1
    for i in range(1,len(S),2):
        if S[i+1] in 'RUD' and S[i] in 'LUD':
            point += 2

if point == len(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin

s = list(stdin.readline().rstrip())

ans = True

odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i, t in enumerate(s):
    if (i+1)%2 == 1:
        if not t in odd:
            ans = False
    else:
        if not t in even:
            ans = False

if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
odd = S[::2]
even = S[1::2]
if not('L' in odd) and not('R' in even):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()

for i in range(len(s)):
    if (i%2==0) & (s[i]=="L"):
        print("No")
        exit()
    if (i%2!=0) & (s[i]=="R"):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
if 'L' in S[::2] or 'R' in S[1::2]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = input()
if not 'L' in S[::2] and not 'R' in S[1::2]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)):
    if (i + 1) % 2 == 1 and s[i] == "L":
        print("No")
        break
    elif (i + 1) % 2 == 0 and s[i] == "R":
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()

for i in range(1, len(s) + 1):
    if i % 2 == 1:
        if s[i - 1] == "R" or s[i - 1] == "U" or s[i - 1] == "D":
            continue
        else:
            print("No")
            break
    else:
        if s[i - 1] == "L" or s[i - 1] == "U" or s[i - 1] == "D":
            continue
        else:
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:
word = str(input())
even = word[1::2]
odd = word[::2]
if ("R" in even) or ("L" in odd):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s=input()

for i in range(len(s)):
  if i % 2 == 1:
    if s[i] == 'R':
      print('No')
      exit(0)
  else:
    if s[i] == 'L':
      print('No')
      exit(0)
print('Yes')

Submission status: Accepted

Solution code:
S=input()
count=0
Ans=True
for i in range(len(S)):
    if i%2==1 and S[i]=="R":
        Ans=False
    elif i%2==0 and S[i]=="L": 
        Ans=False
if Ans==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

for i in range(len(S)):
    if i % 2 != 0:
        if S[i] == 'R':
            print('No')
            exit()
    else:
        if S[i] == 'L':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
yes = True
for i in range(n):
    if i % 2 == 0:
        if s[i] == "L":
            yes = False
    elif s[i] == "R":
        yes = False
if yes:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# abc141_b.py
# https://atcoder.jp/contests/abc141/tasks/abc141_b

# B - Tap Dance /
# 実行時間制限: 2 sec / メモリ制限: 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


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[0]
    # N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    rstr = ''
    lstr = ''

    for i, char in enumerate(S):
        if i % 2 == 0:
            rstr += char
        else:
            lstr += char
    
    if 'L' in rstr:
        result = 'No'
    elif 'R' in lstr:
        result = 'No'
    else:
        result = 'Yes'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['RUDLUDR']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['DULL']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['UUUUUUUUUUUUUUU']
        lines_export = ['Yes']
    if pattern == 4:
        lines_input = ['ULURU']
        lines_export = ['No']
    if pattern == 5:
        lines_input = ['RDULULDURURLRDULRLR']
        lines_export = ['Yes']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
ret = 'Yes'
for i, j in enumerate(s):
    if (i+1)%2 == 1 and j not in odd:
        ret = 'No'
        break
    elif (i+1)%2 == 0 and j not in even:
        ret = 'No'
        break
print(ret)

Submission status: Accepted

Solution code:
s=input();print('No'if'L'in s[::2] or'R'in s[1::2] else'Yes')

Submission status: Accepted

Solution code:
s=input();print('No'if [1 for i in s[::2] if i=='L'] or [1 for i in s[1::2] if i=='R'] else'Yes')

Submission status: Accepted

Solution code:
import sys
s=input()
for i in range(len(s)):
    if i%2==0 and "L" in s[i]:
        print("No")
        sys.exit()
    elif i%2==1 and "R" in s[i]:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

check = True
for i, s in enumerate(S):
  if (i+1)%2 == 0:
    if not(s == "L" or s == "U" or s == "D"):
      check = False
  else:
    if not(s == "R" or s == "U" or s == "D"):
      check = False

if check:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
deff = 1
for i in range(len(s)):
  if (i % 2 == 0):
    if s[i] == 'L':
      deff = 0
  else:
    if s[i] == 'R':
      deff = 0
if deff == 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = 0

for i in range(n):
    if i % 2 == 0:
        if s[i] != 'L':
            ans += 1
    else:
        if s[i] != 'R':
            ans += 1
            
if ans == n:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
print('No' if 'L' in s[::2] or 'R' in s[1::2] else 'Yes')

Submission status: Accepted

Solution code:
s = input()
print('Yes' if set(s[::2]) <= {'R', 'U', 'D'} and set(s[1::2]) <= {'L', 'U', 'D'} else 'No')

Submission status: Accepted

Solution code:
S = input()

gu = ['R', 'U', 'D']
ki = ['L', 'U', 'D']
flag = True
for i, s in enumerate(S):
    if i%2==0:
        if s in gu:
            pass
        else:
            flag = False
            break
    else:
        if s in ki:
            pass
        else:
            flag = False
            break

if flag:
    print('Yes')
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
flag = True
for i in range(len(S)):
  if (i+1) % 2 == 1:
    if S[i] =="R" or S[i] =="U" or S[i] =="D":
      pass
    else:
      flag = False
      break
  else:
    if S[i] =="L" or S[i] =="U" or S[i] =="D":
      pass
    else:
      flag = False
      break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=input()
ans='Yes'
for i in range(len(s)):
  if i%2==0:
    if s[i]=='L':
      ans='No'
  else:
    if s[i]=='R':
      ans='No'
print(ans)

Submission status: Accepted

Solution code:
odd=["R","U","D"]
even=["L","U","D"]
S=input()
i=0
for x in range(len(S)):
  if x%2==0 and S[x] in odd:
    i+=1
  elif x%2==1 and S[x] in even:
    i+=1
if i==len(S):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S=input()
count=0
s=list(S)
for i in range(len(S)):
    if (i+1)%2!=0:
        if s[i]=='R' or s[i]=='U' or s[i]=='D':
            count+=1
    else:
        if s[i]=='L' or s[i]=='U' or s[i]=='D':
            count+=1
if count==len(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S=input()

ans='Yes'
for i in range(len(S)):
  if (i%2==1) and (S[i] not in {'L','U','D'}):ans='No'
  if (i%2==0) and (S[i] not in {'R','U','D'}):ans='No'
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

for i in range(len(s)):
  if (i+1)%2 == 0:
    if s[i] != "R":
      continue
    else:
      print("No")
      exit()
      
  else:
    if s[i] != "L":
      continue
    else:
      print("No")
      exit()
      
print("Yes")

Submission status: Accepted

Solution code:
s = input()
print(["Yes", "No"]["L" in s[::2] or "R" in s[1::2]])

Submission status: Accepted

Solution code:
S = input()
for i, s in enumerate(list(S), 1):
    if (i % 2 == 0 and s == 'R') or (i % 2 == 1 and s == 'L'):
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input().rstrip()
for i,l in enumerate(s):
    if i&1:
        if 'R' in l:
            print('No')
            break
    else:
        if 'L' in l:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

s = s()

for i in range(len(s)):
    if (i+1) % 2 !=0:
        if s[i] == "R" or s[i]=="U" or s[i]=="D":
            pass
        else:
            print("No")
            sys.exit()
    else:
        if s[i]=="L" or s[i]=="U" or s[i]=="D":
            pass
        else:
            print("No")
            sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
s = input()
l1 = ['D','R','U']
l2 = ["D",'L','U']
count = 0

for i in s[::2]:
    if i in l1 :
        count += 1
for i in s[1::2]:
    if i in l2:
        count += 1
    
if count == len(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
    S = str(input())
    odd = (len(S) // 2) + (len(S) % 2)
    even = len(S) // 2
    check_odd = 0
    check_even = 0
    c = 0
    for i in range(odd):
        if S[c] == 'R' or S[c] == 'U' or S[c] == 'D':
            check_odd = check_odd + 1
        c = c + 2
    c = 1
    for i in range(even):
        if S[c] == 'L' or S[c] == 'U' or S[c] == 'D':
            check_even = check_even + 1
        c = c + 2
    if check_even == even and check_odd == odd:
        print('Yes')
    else:
        print('No')
main()

Submission status: Accepted

Solution code:
s=input()
ok=True

for i in range(len(s)):
    if (i+1)%2==1:
        if s[i]=='L': 
            ok=False
    else:
        if s[i]=='R':
            ok=False
if(ok):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
S = list(input())
S_odd = S[::2]
S_even = S[1::2]
easy_odd = ['R','U','D']
easy_even = ['L','U','D']

print('Yes') if set(S_odd).issubset(easy_odd) and set(S_even).issubset(easy_even) else print('No')

Submission status: Accepted

Solution code:
s = input()
flag = True
for i in range(len(s)):
  if i%2==0:
    if s[i] not in ['R', 'U', 'D']:
      flag = False
      break
  else:
    if s[i] not in ['L', 'U', 'D']:
      flag = False
      break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
S = input()
for i in range(0, len(S), +2):
    if S[i] == "L":
        print("No")
        sys.exit()    
if len(S) == 1:
    print("Yes")
    sys.exit()
for i in range(1, len(S), +2):
    if S[i] == "R":
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
N=str(input())
if 'L' in N[0::2] or 'R' in N[1::2]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = input()
odd_S = S[0::2]
even_S = S[1::2]
if 'L' in odd_S or 'R' in even_S:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
odd = ["R","U","D"]
even = ["L","U","D"]
cnt = 0
for i in s[::2]:
    if i in odd:
        cnt += 1
for j in s[1::2]:
    if j in even:
        cnt += 1
        
print("Yes") if cnt == len(s) else print("No")

Submission status: Accepted

Solution code:
li=list(input())
ll=[]
rr=[]
fl=True
for i in li:
  if fl:
    fl=False
    rr.append(i)
    continue
  fl=True
  ll.append(i)
if "L" in rr or "R" in ll:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
S=input()
print("YNeos"["L" in S[0::2] or "R" in S[1::2]::2])

Submission status: Accepted

Solution code:
import re
S=input()
print("NYoe s"[len(re.sub("[RUD]",'',S[0::2]))==0==len(re.sub("[LUD]",'',S[1::2]))::2])

Submission status: Accepted

Solution code:
s = input()

od = s[0 :: 2]
ev = s[1 :: 2]

if all(x != 'L' for x in od) and all(y != 'R' for y in ev):
  print('Yes')

else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
x = 0


for i in range(1,len(s),2):
    if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
        x += 1

for i in range(0,len(s),2):
    if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
        x += 1


if x == len(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
S = input()

for i in range(len(S)):
    if (i%2==0 and S[i] in ["R", "U", "D"]) or (i%2!=0 and S[i] in ["L", "U", "D"]):
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
odd_S = S[0::2]
even_S = S[1::2]
if 'L' in odd_S or 'R' in even_S:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=input()
count=0
for i in range(len(S)):
  if(i%2==0 and (S[i]=="R" or S[i]=="U" or S[i]=="D")):
    count+=1
  elif(i%2!=0 and (S[i]=="L" or S[i]=="U" or S[i]=="D")):
    count+=1
if(count==len(S)):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
print("Yes" if all(s in ["R","U","D"] for s in S[::2]) \
      and all(s in ["L","U","D"] for s in S[1::2]) else "No")

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    for i, c in enumerate(list(S)):
        if i%2==0:
            if c == "L":
                print("No")
                return
        else:
            if c == "R":
                print("No")
                return
    print("Yes")

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
S=input()
isOK=True
for i in range(len(S)):
  if((i+1)%2==1):
    if(S[i]=="L"):
      isOK=False
  else:
    if(S[i]=="R"):
      isOK=False
      
if(isOK):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
for i in range(1, len(S) + 1):
    if (i % 2 == 1 and S[i - 1] == 'L'
    or i % 2 == 0 and S[i - 1] == 'R'):
        print('No')
        quit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
for i in range(len(s)):
    if i%2 and not(s[i] in 'LUD'):
        ans = 'No'
        break
    if not(i%2) and not(s[i] in 'RUD'):
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
S = input()
for i, s in enumerate(S, 1):
    if (i%2==1 and s=='L') or (i%2==0 and s=='R'):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
import numpy as np
s = input()
ns = np.array(list(s))
n1 = ns[::2]
n2 = ns[1::2]
if not 'L' in n1 and not 'R' in n2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

ans = 'Yes'
for i, si in enumerate(s):
    if ((i % 2 == 0) and (si == 'L')) or ((i % 2 == 1) and (si == 'R')):
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
S=input()
for i,s in enumerate(S):
  if ((i+1)%2 == 1 and s=='L') or ((i+1)%2==0 and s=='R'):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()

for i, ch in enumerate(S):
    if i % 2 == 0 and ch == 'L':
        print("No")
        exit()
    elif i % 2 == 1 and ch == 'R':
        print('No')
        exit()    
print("Yes")

Submission status: Accepted

Solution code:
import sys
s=list(input())

if "L" not in s[::2] and "R" not in s[1::2]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys

s = input()

for c in s[::2]:
    if(c == 'L'):
        print("No")
        sys.exit()

for c in s[1::2]:
    if(c == 'R'):
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
a = ['R','U','D']
b = ['L','U','D']
s = input()
flag = True
for i in range(len(s)):
    if (i+1) % 2 == 0:
        if s[i] not in b:
            flag = False
    else:
        if s[i] not in a:
            flag = False

if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#B
import sys
s = list(input())
one=["R", "U", "D"]
two=["L", "U", "D"]
for i in range(len(s)):
    if i % 2 == 0 and (one[0] != s[i] and one[1]!=s[i] and one[2]!=s[i]):
        print("No")
        sys.exit()
    if i % 2 != 0 and(two[0] != s[i] and two[1]!=s[i] and two[2]!=s[i]):
        print("No")
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys

s = input()
for i in range(len(s)):
  if i % 2 == 1:
    if s[i] == "R":
      print("No")
      sys.exit()
  else:
    if s[i] == "L":
      print("No")
      sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S=list(input())
count=0
for i in range(len(S)):
  if i%2==0 and (S[i]=="R" or S[i]=="U" or S[i]=="D"):
    count+=1  
  elif i%2==1 and (S[i]=="L" or S[i]=="U" or S[i]=="D"):
    count+=1
if count==len(S):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()

sa = s[::2]
sb = s[1::2]

for i in sa:
  if i == "L":
    print("No")
    exit()

for j in sb:
  if j == "R":
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
S=input()

for s in S[::2]:
    if s=='L':
        print ('No')
        exit()

for s in S[1::2]:
    if s=='R':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
import sys
s = list(input())

i = 0
for e in s:
    if i % 2 == 0 and e == 'L':
        print('No')
        sys.exit()
    elif i % 2 == 1 and e == 'R':
        print('No')
        sys.exit()
    i += 1

print('Yes')

Submission status: Accepted

Solution code:
s = list(input())

odd = s[::2]
even = s[1::2]
ans = "Yes"

if "L" in odd or "R" in even:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:
import sys

s = input()
for i in range(len(s)):
    if ((i+1) % 2 == 1):
        if (s[i] == 'L'):
            print("No")
            sys.exit()
    elif ((i+1) % 2 == 0):
        if (s[i] == 'R'):
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
s = str(input())

for i in range(len(s)):
    #print(s[i])
    if i%2 == 0:        #偶数
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            print('No')
            exit()
    elif i%2 == 1:       #奇数
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            print('No')
            exit()
    

print('Yes')

Submission status: Accepted

Solution code:
import sys
S = input()
n = len(S)
for i in range(n):
  if ((i+1) % 2 != 0 and S[i] == 'L') or ((i+1) % 2 == 0 and S[i] == 'R'):
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()
for i in range(len(s)):
	if i%2 == 0 and s[i] not in ["R","U","D"]:
		print("No")
		exit()
	elif i%2 == 1 and s[i] not in ["L","U","D"]:
		print("No")
		exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
even, odd = [], []
for i in range(len(s)):
    if i%2:
        odd.append(s[i])
    else:
        even.append(s[i])
e = list(set(odd))
o = list(set(even))
if('L' in o or 'R' in e):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(N):
    if i%2==0:
        if not(S[i]=="R" or S[i]=="U" or S[i]=="D"):
            print("No")
            break

    else:
        if not (S[i]=="L" or S[i]=="U" or S[i]=="D"):
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
n = len(s)


for i in range(n):
    if (i+1)%2 == 0 and s[i] == 'R':
        print('No')
        break
    elif (i+1)%2 == 1 and s[i] == 'L':
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
def main():
    S = input().rstrip()
    for idx, s in enumerate(S, start=1):
        if idx % 2 == 1 and s not in ["R", "U", "D"]:
            print("No")
            exit()
        elif idx % 2 == 0 and s not in ["L", "U", "D"]:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
ans = "Yes"
if "L" in s[::2]:
    ans = "No"
if "R" in s[1::2]:
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()
a = "Yes"

if "L" in S[0::2] or "R" in S[1::2]:
  a = "No"

print(a)

Submission status: Accepted

Solution code:
s = input()

t = "Yes"
for i in range(len(s)):
    if i%2==0:
        if s[i] == "L":
            t = "No"
            break
    else:
        if s[i] == "R":
            t = "No"
            break
print(t)

Submission status: Accepted

Solution code:
#<B>
S = input()
S1 = S[0::2]
S2 = S[1::2]
ans1 = S1.count("R") + S1.count("U") + S1.count("D")
ans2 = S2.count("L") + S2.count("U") + S2.count("D")
if ans1 == len(S1) and ans2 == len(S2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
S_even = S[1::2]
S_odd = S[0::2]

if 'L' not in S_odd and 'R' not in S_even:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)) :
    if i % 2 != 0 :
        if s[i] != "L" and s[i] != "U" :
            if s[i] != "D" :
                print("No")
                break
    elif i % 2 == 0 :
        if s[i] != "R" and s[i] != "U" :
            if  s[i] != "D" :
                print("No")
                break

else :
    print("Yes")

Submission status: Accepted

Solution code:
S = list(map(str,input()))

odd = ['R','U','D']
even = ['L','U','D']

for i in range(len(S)):
    if (i+1)%2 == 0:
        if S[i] in 'R':
            print('No')
            exit()
    elif (i+1)%2 == 1:
        if S[i] in 'L':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
for i,k in enumerate(s):
  num = i + 1
  if num % 2 == 0 and k not in set('LUD'):
    ans = 'No'
    break
  if num % 2 == 1 and k not in set('RUD'):
    ans = 'No'
    break
print(ans)

Submission status: Accepted

Solution code:
S = input()

for i in S[::2]:
  if i not in "RUD":
    print("No")
    exit()

for i in S[1::2]:
  if i not in "LUD":
    print("No")
    exit()
    

print("Yes")

Submission status: Accepted

Solution code:
a=input()
ok=True
for i in range(len(a)):
    if (i+1)%2==0 and a[i]=="R":
        ok=False
        break
    if (i+1)%2==1 and a[i]=="L":
        ok=False
        break
 
if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = str(input())
bool =False
for i in range (len(s)):
  if i % 2 == 0 and s[i] == 'L':
    bool = True
  elif i % 2 != 0 and s[i] == 'R':
    bool = True
if bool == True:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in range(len(s)):
  if i % 2 != 0 and (s[i] == 'L' or s[i] == 'U' or s[i] == 'D'):
    count += 1
  elif i % 2 == 0 and (s[i] == 'R' or s[i] == 'U' or s[i] == 'D'):
    count += 1
if count == len(s):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    s = insr()
    q = "Yes"
    for i in range(len(s)):
        if (i % 2 == 0 and s[i] == "L") or (i % 2 != 0 and s[i] == "R"):
            q = "No"
    print(q)
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)

def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))

def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Submission status: Accepted

Solution code:
import sys


# input = sys.stdin.readline

def main():
    S = input()
    count =1
    for i in S:
        if count %2==1 and i =="L":
            print("No")
            exit()
        elif count%2 ==0 and i =="R":
            print("No")
            exit()

        count+=1
    print("Yes")





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
a = 'Yes'
for i in range(len(s)):
  if i%2==0:
    if s[i]!='R' and s[i]!='U' and s[i]!='D':
      a = 'No'
  else:
    if s[i]!='L' and s[i]!='U' and s[i]!='D':
      a = 'No'
print(a)

Submission status: Accepted

Solution code:
S_list = list(input())

for i in range(0, len(S_list), 2):
    if S_list[i] == 'R' or S_list[i] == 'U' or S_list[i] == 'D':
        pass
    else:
        print('No')
        exit()

for i in range(1, len(S_list), 2):
    if S_list[i] == 'L' or S_list[i] == 'U' or S_list[i] == 'D':
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
o = [i == "L" for i in s[::2]] + [i == "R" for i in s[1::2]]
print("YNeos"[sum(o) != 0::2])

Submission status: Accepted

Solution code:
s = input()

s = list(s)
answer = True
for i in range(len(s)):
  if i%2 == 0:
    if(s[i] == "L"):
      answer = False
      break
  else:
    if(s[i] == "R"):
      answer = False

if answer :
  print("Yes")
else :
  print("No")

Submission status: Accepted

Solution code:
import math

S = list(input())
a =0
b = 0
n=len(S)
for i in range(0,n,2):
  if(S[i]=="R" or S[i]=="U" or S[i]=="D"):
    a +=1
for j in range(1,n,2):
  if(S[j]=="L" or S[j]=="U" or S[j]=="D"):
    b+=1
if(a==math.ceil(n/2) and b ==math.floor(n/2)):
  print("Yes")
else:
  print("No")