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()
if "L" not in list(s[::2]) and "R" not in list(s[1::2]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

s_odd = s[::2]
s_even = s[1::2]

if all(list(map(lambda x: x in ['R', 'U', 'D'], s_odd))) and all(list(map(lambda x: x in ['L', 'U', 'D'], s_even))):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
result = "Yes"
flag = True
for i in S:
    if flag:
        if i == "L":
            result = "No"
            break
    else:
        if i == "R":
            result = "No"
            break
    flag = not flag
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	S = input()
	S = S[:-1]

	flg = True

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

	for i in range(1,len(S),2):
		if S[i] == "L" or S[i] == "U" or S[i] == "D":
			continue
		else:
			print("No")
			sys.exit()

	print("Yes")



if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
def do():
    frag = 1
    S = str(input())
    for i in range(len(S)):
        if (i+1)%2 == 1:
            if S[i] == 'L':
                frag = 0
#                print(i)
        else:
            if S[i] == 'R':
                frag = 0
#                print(i)
    if frag == 1:
        print('Yes')
    else:
        print('No')
            
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
def solve(S):
    for i in range(1, len(S)+1):
        c = S[i-1]
        if i % 2 == 1 and c not in "RUD":
            return "No"
        if i % 2 == 0 and c not in "LUD":
            return "No"
    return "Yes"
                

def main():
    S = input().strip()
    print(solve(S))

main()

Submission status: Accepted

Solution code:
s=input()

flag=True

for i in range(0,len(s),2):
    if s[i]=="L":
        flag=False
for i in range(1,len(s),2):
    if s[i]=="R":
        flag=False
        
if flag==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)

count = 0
for i in range(N):
  if(i%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 == N):
 print('Yes')
else:
 print('No')

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
ans = 'Yes'
for i in range(n):
    if (i+1)%2==1:
        if s[i]=='R' or s[i]=='U' or s[i]=='D':
            continue
        else:
            ans ='No'
            break
    else:
        if s[i]=='L' or s[i]=='U' or s[i]=='D':
            continue
        else:
            ans='No'
            break
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
    S = input().strip()
    Ans = 'Yes'
    for i,Si in enumerate(S):
        if i % 2 == 0:
            if not Si in ['R','U','D']:
                Ans = 'No'
                break
        else:
            if not Si in ['L','U','D']:
                Ans = 'No'
                break
    print(Ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
ans = True
for i in range(len(s)):
    if i % 2 == 0 and not s[i] in "RUD":
        ans = False
    elif i % 2 == 1 and not s[i] in "LUD":
        ans = False

print("Yes" if ans else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().rstrip()

bl = True
for x in S[::2]:
    if x == 'L':
        bl = False
for x in S[1::2]:
    if x == 'R':
        bl = False

answer = 'Yes' if bl else 'No'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i in range(0, N, 2):
    if S[i] not in odd:
        print('No')
        exit()

for i in range(1, N, 2):
    if S[i] not in even:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
s=input()
odd=["R", "U", "D"]
even=["L", "U", "D" ]

cnt=1
for i in s:
  if cnt%2==1:
    if i not in odd:
      print("No")
      exit()
  else:
    if i not in even:
      print("No")
      exit()
  cnt+=1
print("Yes")

Submission status: Accepted

Solution code:
S = input()
isEven = True

ans = True

for c in S:
    if isEven and c == "L":
        ans = False
        break
    if not isEven and c == "R":
        ans = False
        break

    isEven = not isEven

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

Submission status: Accepted

Solution code:
S = input()

for i, s in enumerate(S):

    if i % 2 == 0 and s not in ['R', 'U', 'D']:
        print('No')
        break
    elif i % 2 != 0 and s not in ['L', 'U', 'D']:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
def main():    
    s = input()
    ans = "Yes"
    for i in range(len(s)):
        if i%2 == 1 and s[i] == "R":
            ans = "No"
        elif i%2 == 0 and s[i] =="L":
            ans = "No"
    print(ans)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#import sys
#input = sys.stdin.readline
def main():
    S = input()
    N = len(S)
    for i in range(0, N, 2):
        if S[i] == "L":
            print("No")
            return
    for i in range(1,N,2):
        if S[i] == "R":
            print("No")
            return
    print("Yes")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=list(input())
ans="Yes"
l=len(s)
for i in range(l//2):
    if(s[i*2+1]=="R"):
        ans="No"
for i in range((l//2)+(l%2)):
    if(s[i*2]=="L"):
        ans="No"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

print(ans)

Submission status: Accepted

Solution code:
S = input()
g = []
k = []
ans = 1
for i,s in enumerate(S):
    if i % 2 == 0:
        if s == "L":
            ans *= 0
    else:
        if s == "R":
            ans *= 0
if ans ==0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()

f = 0
for i in s:
    if f == 0:
        if not i in ['R', 'U', 'D']:
            print("No")
            exit()
    else:
        if not i in ['L', 'U', 'D']:
            print("No")
            exit()


    f = 1 - f
print("Yes")

Submission status: Accepted

Solution code:
s = input()
flag = True
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "L":
            flag = False
    else:
        if s[i] == "R":
            flag = False

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    for index, s in zip(range(len(S)), list(S)):
        # 奇数文字目 Lがダメ
        if (index + 1) % 2 == 1 and s == "L":
            print("No")
            return
        # 偶数文字目 Rがダメ
        elif (index + 1) % 2 == 0 and s == "R":
            print("No")
            return

    print("Yes")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=input()

f=1

for i in range(len(s)):
  if i%2==0:
    if s[i]=="L":f=0
  else:
    if s[i]=="R":f=0

if f==1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())
mod2 = False
flag = True
for i in S:
    if mod2:
        mod2 = False
        if i == 'R':
            flag = False
            break
    else:
        mod2 = True
        if i == 'L':
            flag = False
            break

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

Submission status: Accepted

Solution code:
S = list(input())

ok = True
for i in range(len(S)):
    banme = i + 1

    if banme % 2 == 1:
        if S[i] == "R" or S[i] == "U" or S[i] == "D":
            pass
        else:
            ok = False
    else:
        if S[i] == "L" or S[i] == "U" or S[i] == "D":
            pass
        else:
            ok = False

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    for i, s in enumerate(S):
        if i % 2 == 0:
            if s not in ["R", "U", "D"]:
                print("No")
                exit()
        else:
            if s not in ["L", "U", "D"]:
                print("No")
                exit()

    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

a1 = ["R","U","D"]
a2 = ["L","U","D"]

for i in range(len(s)):
	if i % 2 == 0:
		if a1.count(s[i]) == 0:
			print("No")
			exit()
	else:
		if a2.count(s[i]) == 0:
			print("No")
			exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()

even = s[::2]
odd = s[1::2]

for i in even:
    if i not in ["R", "U", "D"]:
        print("No")
        exit()

for i in odd:
    if i not in ["L", "U", "D"]:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().strip()

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            print("No")
            sys.exit()
    else:
        if S[i] == "R":
            print("No")
            sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
import sys; from collections import deque; readline = sys.stdin.readline;

S = readline().rstrip()

L,R, U, D = 'L', 'R', 'U', 'D'

if all(a == R or a == U or a == D for a in S[0::2]) and all(a==L or a==U or a==D for a in S[1::2]):
    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] not in ['R', 'U', 'D']:
            print('No')
            break
    else:
        if S[i] not in ['L', 'U', 'D']:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque, Counter as cnt

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]
def nlist(n, v):
    if not n: return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]

# エントリーポイント
def main():
    S = input(str)
    for s in S[::2]:
        if s == "R" or s == "U" or s == "D":
            continue
        print("No")
        return

    for s in S[1::2]:
        if s == "L" or s == "U" or s == "D":
            continue
        print("No")
        return
    print("Yes")
    return

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

Solution code:
s = input()
even = 'RUD'
odd = 'LUD'
print('Yes' if all(c in even for c in s[::2]) and all(
    c in odd for c in s[1::2]) else 'No')

Submission status: Accepted

Solution code:
S = list(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:
s = list(input())
odd = s[::2]
b = s[1::2]
if 'L' not in odd and 'R' not in b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

for i in range(len(S)):
    if (i + 1) % 2 == 0:
        if S[i]  not in "LUD":
            print('No')
            exit()
    else:
        if S[i]  not in "RUD":
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
easy = True
s=input()
for i in range(len(s)):
    if i%2==0:
        if s[i]=="L":
            easy = False
            break
    else:
        if s[i]=="R":
            easy  =False
            break

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

Submission status: Accepted

Solution code:
S = input()

f = True

for i in range(len(S)):
    if i%2==1:
        if S[i]=='R':
            f=False
            break
    else:
        if S[i]=='L':
            f=False
            break
if f: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
s = input().rstrip()
evens = ["L", "U", "D"]
odds = ["R", "U", "D"]
is_easy = True
for i, ch in enumerate(s):
    if i % 2 == 0:
        if ch not in odds:
            is_easy = False
    else:
        if ch not in evens:
            is_easy = False
if is_easy:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=list(input())
odd=['R','U','D']
even=['L','U','D']

for i in range(len(s)):
    if (i+1)%2:
        if s[i] not in odd:
            print('No')
            exit()
    else:
        if s[i] not in even:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()

for i, a in enumerate(S):
    if i % 2 == 1 and a == 'R':
        print('No')
        break
    if i % 2 == 0 and a == 'L':
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
flag=0
for i in s[::2]:
    if i not in ["R","U","D"]:
        flag=1

for i in s[1::2]:
    if i not in ["L","U","D"]:
        flag=1

if flag==0:
    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:
s = input()
for i in range(len(s)):
    if (i % 2 == 0 and s[i] == 'L') or (i % 2 == 1 and s[i] == 'R'):
        print("No")
        quit()
print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
Kisuu = ['R','U','D']
Guusuu = ['L','U','D']

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

s = input().split()
s = list(s[0])

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

Submission status: Accepted

Solution code:
S = input()
flag = True
for i, s in enumerate(S):
    if i % 2 == 1 and s == 'R':
        flag = False
        break
    elif i % 2 == 0 and s == 'L':
        flag = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
j=0
for i in S:
    if j==1 and i=="R":
        print("No")
        exit()
    if j==0 and i=="L":
        print("No")
        exit()
    j=1-j
print("Yes")

Submission status: Accepted

Solution code:
S = input()

S1 = set(S[::2])
S2 = set(S[1::2])

if len(S1-set(["R","U","D"])) > 0:
    print("No")
    exit()
if len(S2-set(["L","U","D"])) > 0:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s=input()
b=0
for i in range(len(s)):
    if (i+1)%2==0 and s[i]=='R':
        b=1
    elif (i+1)%2==1 and s[i]=='L':
        b=1
print('No' if b else 'Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

A = ["R","U","D"]
B = ["L","U","D"]

flag = True
for i in range(len(S)):
    # 偶数
    if i % 2 == 0:
        if S[i] not in A:
            flag = False
    else:
        if S[i] not in B:
            flag = False

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

Submission status: Accepted

Solution code:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    s = input()

    for i in range(len(s)):
        if i % 2:
            if s[i] not in ['L', 'U', 'D']:
                print('No')
                sys.exit()
        else:
            if s[i] not in ['R', 'U', 'D']:
                print('No')
                sys.exit()

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
ans = True
for i, v in enumerate(s):
    i += 1
    if i % 2:
        if not v in ['R', 'U', 'D']:
            ans = False
            break
    else:
        if not v in ['L', 'U', 'D']:
            ans = False
            break

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

Submission status: Accepted

Solution code:
S = input()

flag = True

for i in range(len(S)):
    if i % 2 == 0 and S[i] == 'L':
        flag = False
    elif i % 2 == 1 and S[i] == 'R':
        flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

humi = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] not in ['R', 'U', 'D']:
            humi *= 0
            break
    if i % 2 == 1:
        if S[i] not in ['L', 'U', 'D']:     
            humi *= 0
            break
if humi == 1:
    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] == "L":
        print("No")
        sys.exit()
    if i %2 == 1 and s[i] == "R":
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
for i, s in enumerate(S):
    if i % 2 == 0:
        if s not in 'RUD':
            print('No')
            exit()
    else:
        if s not in 'LUD':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    ls = list(input())
    for i,now in enumerate(ls):
        if i%2 == 0:
            if now in ["R","U","D"]:
                pass
            else:
                print("No")
                exit()
        else:
            if now in ["L","U","D"]:
                pass
            else:
                print("No")
                exit()
    print("Yes")
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S=input()
N=len(S)
flag="Yes"
for i in range(N):
  if(i%2==0 and S[i]=="L"):
    flag="No"
    break
  if(i%2==1 and S[i]=="R"):
    flag="No"
    break
print(flag)

Submission status: Accepted

Solution code:
S = input()

ans = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] not in ['R', 'U', 'D']:
            ans = False
            break
    else:
        if S[i] not in ['L', 'U', 'D']:
            ans = False
            break
print('Yes' if ans else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
res = [1 for i,x in enumerate(S) if ((i+1)%2==0 and x in ['L','U','D']) or ((i+1)%2!=0 and x in ['R','U','D'])]
if sum(res)==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 == 0 and S[i] == "L" or i % 2 == 1 and S[i] == "R":
    ans = "No"
    break
print(ans)

Submission status: Accepted

Solution code:
S=list(input())

E=[]
O=[]
for i in range(len(S)):
    if i%2==0:
        O.append(S[i])
    else:
        E.append(S[i])

if "L" in O or "R" in E:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    S = input()
    for i in range(len(S)):
        if S[i] == "L" and (i + 1) % 2 == 1:
            No()
            exit()
        if S[i] == "R" and (i + 1) % 2 == 0:
            No()
            exit()
    Yes()

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

S = stdin.readline().rstrip()

for i, s in enumerate(S):
    # 奇数
    if (i+1) % 2 != 0:
        if s in ["R", "U", "D"]:
            pass
        else:
            print("No")
            exit()

    else:
        if s in ["L", "U", "D"]:
            pass
        else:
            print("No")
            exit()


print("Yes")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str):

    for i, s in enumerate(S):
        if (i+1) % 2 == 1:
            if s == "L":
                print(NO)
                return
        else:
            if s == "R":
                print(NO)
                return

    print(YES)


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
odd = ['R','U','D']
even = ['L','U','D']
for i in range(len(s)):
    t = s[i]
    if(i%2 == 0):
        if(t not in odd):
            print('No')
            exit()
    else:
        if(t not in even):
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()

easy = True

for i in range(0, len(S)):
    if (i + 1) % 2 == 0:
        if S[i] == "R":
            easy = False
            break
    else:
        if S[i] == "L":
            easy = False
            break

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    s = input()
    for i, c in enumerate(s):
        if i % 2 == 0 and c == 'L':
            print("No")
            return
        if i % 2 == 1 and c == 'R':
            print("No")
            return
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from heapq import heappush, heappop
import queue
import re
import math
import functools

def s_raw():
    return input().rstrip("\r")

def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return list(map(int, ss_raw()))


INF = 1 << 29


def make1d_arr(n, val=INF):
    return [val for i in range(n)]


def make2d_arr(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)


def BFord(n,es):
    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
        if v == n-1:
            prev = v_cost[:]
    v_cost = [-INF if prev[idx]!=v_cost[idx] else v_cost[idx] for idx in range(n)]
    return v_cost
    

def main():
    TS = [["R", "U", "D"], ["L", "U", "D"]]
    S = s_raw()
    for idx,c in enumerate(S):
        if not(c in TS[idx%2]):
            return "No"
    
    return "Yes"

if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
s = input()
odd = {'R', 'U','D'}
even = {'L', 'U', 'D'}

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

Submission status: Accepted

Solution code:
S = str(input())

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

Submission status: Accepted

Solution code:
S = input()
S_ki = S[0::2]
S_gu = S[1::2]

import sys
for k in S_ki:
    if k == "L":
        print("No")
        sys.exit()
for g in S_gu:
    if g == "R":
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    b = True
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == "R" or s[i] == "U" or s[i] == "D":
                b = True
            else:
                b = False
                break
        else:
            if s[i] == "L" or s[i] == "U" or s[i] == "D":
                b = True
            else:
                b = False
                break
    if b:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    slove()