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: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    S = input()
    s_len = len(list(S))
    for i in range(s_len):
        s = S[i]
        #print(i)
        #print(s)
        ans = "Yes"
        if i % 2 == 0:
            if s == "R" or s == "U" or s == "D":
                pass
            else:
                ans = "No"
                break
        else:
            if s == "L" or s == "U" or s == "D":
                pass
            else:
                ans = "No"
                break

    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
ok=1
for i in range(1,len(s),2):
    if s[i-1] not in 'RUD':
        ok = 0
    if s[i] not in 'LUD':
        ok = 0
if ok:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
S = input()

tmp = 0

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

print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()

for i in range(len(s)//2):
  if s[2*i]!="R" and s[2*i]!="U" and s[2*i]!="D":
    print("No")
    exit()
  elif s[2*i+1]!="L" and s[2*i+1]!="U" and s[2*i+1]!="D":
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

fail_even = False
fail_odd = False
for i in range(len(S)):
    c = S[i]
    # 偶数番目チェック
    if i % 2 != 0:
        if c not in ['R', 'U', 'D']:
            fail_even = True
    else:
        if c not in ['L', 'U', 'D']:
            fail_odd = True


if not fail_odd and not fail_even:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
ans = True
for i in range(len(s)):
    if i % 2 == 0 and s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
        ans = False
        break
    if 1 % 2 == 1 and s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
        ans = False
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
bool = 0
a = int(len(S)/2)
for i in range(a):
  if S[2*i] == 'L' or S[2*i+1] == 'R':
    bool = 1
if bool == 0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S = ST()
    for i,s in enumerate(S,start = 1):
        if i&1:
            if s == "L":
                print("No")
                exit()
        else:
            if s == "R":
                print(i,s)
                print("No")
                exit()
    print("Yes")
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
if len(s)==1:
  s+="R"
if all(x in "RUD" for x in s[::2]) and all(y in "LUD" for y in s[1::2]):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    for i, s in enumerate(S):
        if i % 2 == 1 and s == 'R':
            print(i)
            return 'No'
        if i % 2 == 0 and s == 'L':
            return 'No'
    return 'Yes'


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
easy = [["L","U","D"],["R","U","D"]]
S = list(input())
ans = "Yes"
for i, s in enumerate(S):
  if not (s in easy[i%2]):
    ans = "No"
    break
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

n = len(s)

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

if error == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
for i, j in enumerate(s):
    if i % 2 != 0:
        if j == 'L':
            print('No')
            exit()
    else:
        if j == 'R':
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
S_odd = [s for i, s in enumerate(S) if i % 2 == 0]
S_even = [s for i, s in enumerate(S) if i % 2 != 0]
if set(S_odd) == {'R', 'U', 'D'} and set(S_even) == {'L', 'U', 'D'}:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
s = list(map(str, input()))
bool = True
while bool == True:
    for i in range(len(s)):
        if i%2 == 0 and s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            bool = True
        elif i%2 == 1 and s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            bool = True
        else:
            bool = False
        
if bool == True:
    print('Yes')
elif bool == False:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
s=input()
i,b=0,0
while i<len(s):
  if (((s[i]=='R') & (i%2==0))|((s[i]=='L') & (i%2==1))):
    b=1
if(b):
  print('NO')
else:
  print('YES')

Submission status: Time Limit Exceeded

Solution code:
S = input()
slen = len(S)
i = int(0)
j = int(0)
while slen >= i:
	if (i%2 == 1 and S[i] == "R","U","D"):
		j = 0
	elif (i%2 == 0 and S[i] == "L","U","D"):
		j = 0
	else:
		j += 1
	i+1
if j == 0:
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
s = input()

odd_s = list(s[0::2])
even_s = list(s[1::2])

to = ['R', 'U', 'D']
te = ['L', 'U', 'D']

if set(odd_s).issubset(to) and set(even_s).issubset(te):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

Odd = ["R", "U", "D"]
Even = ["L", "U", "D"]
S_l = len(S)
result = "Yes"

for i in range(0, S_l):
    if i % 2 == 0:
        if not S[i] in Odd:
            result = "No"
            break
    if i % 2 != 0:
        if not S[i] in Even:
            result = "No"
            break

print(result)

Submission status: Accepted

Solution code:
S = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for x in range(len(S)):
    if (x+1) % 2 == 0:
        if not S[x] in even:
            print('No')
            break
    else:
        if not S[x] in odd:
            print('No')
            break
else:
    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] == 'R' or s[i] == 'U' or s[i] == 'D':
            ans = 'Yes'
        else:
            print('No')
            exit()

    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            ans = 'Yes'
        else:
            print('No')
            exit()

print(ans)

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")
            exit()
    else:
        if(S[i-1] == "L" or S[i-1] == "U" or S[i-1] == "D"):
            continue
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()
point = 0
l = len(S)
i = 0
while i < l:
    if int(i % 2) == 1:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            point += 1
    else:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            point += 1
    i += 1

if point == l:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

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


def is_valid_str(s_list, valid_strs):
    for s in s_list:
        if s not in valid_strs:
            return False

    return True


even_ok = is_valid_str(s_even, ["L", "U", "D"])
odd_ok = is_valid_str(s_odd, ["R", "U", "D"])

if even_ok and odd_ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

s=str(input())

a=0
b=0

for i in range(len(s)):
    if i%2 == 0:
        if "L" in s[i]:
            a+=1

for i in range(len(s)):
    if i%2 != 0:
        if "R" in s[i]:
            b+=1


if a>0 or b>0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

odd = ["R", "U", "D"]
even = ["L", "U", "D"]
ans = "Yes"

for i, s in enumerate(S):
  if i%2==0 and s not in odd:
    ans = "No"
    break
  elif i%2==1 and s not in even:
    ans = "No"
    break

print(ans)

Submission status: Accepted

Solution code:
s = [i for i in input()]
s_len = len(s)
list1 = []
list2 = []
for j in range(0, s_len, 2):
    for even in s[j]:
        list1.append(even in ['R', 'U', 'D'])
for k in range(1, s_len, 2):
    for odd in s[k]:
        list2.append(odd in ['L', 'U', 'D'])

if False in list1:
    print('No')
elif False in list2:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
for i, si in enumerate(s):
  if si in ['U', 'D']:
    continue
  if i % 2 == 1 and si == 'L':
    continue
  if i % 2 == 0 and si == 'R':
    continue
  print('No')
  exit()
print('Yes')

Submission status: Accepted

Solution code:
S=input()
kisu=["R","U","D"]
gusu=["L","U","D"]


for i in range(len(S)):
	if (i+1)%2==0 and S[i] in gusu:
		continue
	elif (i+1)%2!=0 and S[i] in kisu:
		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()
if 'L' in S[::2]:
    print('No')
elif 'R' in S[1::2]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
# sをリスト化
s = list(s)
# 1文字目から一つ置きに抜き出してリスト化
odd_list = s[0::2]
# 2文字目から一つ置きに抜き出してリスト化
even_list = s[1::2]

if "R" not in even_list and "L" not in odd_list:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
result = False
for s in S[::2]:
  if s not in 'RUD':
    break
else:
  for s in S[1::2]:
    if s not in 'LUD':
      break
  else:
    result = True
print('Yes' if result else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
word = input()
odd_v = ['R', 'U', 'D']
odd_list = []
even_v = ['L', 'U', 'D']
even_list = []

for index, i in enumerate(word, 1):
    if index % 2 == 1:
        odd_list.append(i)
    else:
        even_list.append(i)

if set(odd_list).issubset(odd_v) and set(even_list).issubset(even_v):
    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":
      print("No")
      exit()
  elif s[i] == "R":
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    step_odd = 'RUD'
    step_even = 'LUD'
    ans = 'Yes'
    for i,j in enumerate(s):
        if i%2==0 and j not in step_odd:
            ans = 'No'
        elif i%2!=0 and j not in step_even:
            ans = 'No'
        else:
            pass
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def answer(s: str) -> str:
    for i, c in enumerate(s):
        if i % 2 == 0:
            if c == 'L':
                return 'No'
        else:
            if c == 'R':
                return 'No'

    return 'Yes'


def main():
    s = input()
    print(answer(s))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

answer = 'Yes'
for i in range(len(S)):

    if i % 2 == 0:
        if 'L' in S[i]:
            answer = 'No'
    else:
        if 'R' in S[i]:
            answer = 'No'

print(answer)

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()
ans = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            ans = 0
            break
    else:
        if S[i] == "R":
            ans = 0
            break
if ans:
    print("Yes")
else:
    print("No")

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'
    if i%2 != 0 and s[i] == 'R': ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
a = S[::2]
b = S[1::2]

if 'L' in a or 'R' in b:
    print('No')

else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

L = ['R', 'U', 'D']
M = ['L', 'U', 'D']

lens = len(s)
cnt = 0

for i in range(lens):
    if (i+1)%2 == 1 and s[i] in L:
        cnt += 1
    elif (i+1)%2 == 0 and s[i] in M:
        cnt += 1

if cnt == lens:
    print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
N = len(S)
S1 = S[::2]
S2 = S[1::2]

r = sum(s in ['R','U','D'] for s in S1) + sum(s in ['L','U','D'] for s in S2)
print('Yes' if r == N else 'No')

Submission status: Accepted

Solution code:
S = str(input())

flag = True
for i in range(len(S)):
  if i%2==0 and S[i]=="L":
    flag = False
  elif i%2!=0 and S[i]=="R":
    flag = False
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N = str(input())
a = ['R','U','D']
b = ['L','U','D']
c = 0
for i in range(0, len(N)):
    if i % 2 == 0:
        if N[i] in a:
            c += 1

    else:
        if N[i] in b:
            c += 1


if c == len(N):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

ans = True

for c in s[0::2]:
    if c not in {'R', 'U', 'D'}:
        ans = False
        break

for c in s[1::2]:
    if c not in {'L', 'U', 'D'}:
        ans = False
        break

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

def ans141(S:str):
    judge=0

    for i in range(0,len(S)):
        if (i+1)%2==1:
            if S[i]=="R" or S[i]=="U" or S[i]=="D":
                continue
            else:
                judge+=1
        elif (i+1)%2==0:
            if S[i]=="L" or S[i]=="U" or S[i]=="D":
                continue
            else:
                judge+=1
    if judge>0:
        return "No"
    else:
        return "Yes"

print(ans141(S))

Submission status: Accepted

Solution code:
S=input()

def ans141(S:str):
    judge=0

    for i in range(0,len(S)):
        if (i+1)%2==1:
            if S[i]=="R" or S[i]=="U" or S[i]=="D":
                continue
            else:
                judge+=1
        else:
            if S[i]=="L" or S[i]=="U" or S[i]=="D":
                continue
            else:
                judge+=1
    if judge>0:
        return "No"
    else:
        return "Yes"

print(ans141(S))

Submission status: Accepted

Solution code:
S = list(input())


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

print("Yes")

Submission status: Accepted

Solution code:
S = input()

a = {'R', 'U', 'D'}
b = {'L', 'U', 'D'}
Odd = set(S[0::2])
Even = set(S[1::2])

if Even <= b and Odd <= a:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

flug = True
for i, value in enumerate(S):
    if i % 2 == 0:
        if value == 'L':
            flug = False
    else:
        if value == 'R':
            flug = False
if flug:
    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 "RUD":
            print("No")
            break
    else:
        if S[i] not in "LUD":
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [c for c in input()]
result = 'Yes'
for index, step in enumerate(s, start=1):
    if index % 2 == 1:
        if step not in "RUD":
            result = 'No'
            break
    else:
        if step not in "LUD":
            result = 'No'
            break

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
#from queue import *
#import random
#sys.setrecursionlimit(int(1e6))
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

s=insr()

for i in range(0,len(s),2):
	if s[i]=='L':
		print("No")
		exit(0)

for i in range(1,len(s),2):
	if s[i]=='R':
		print("No")
		exit(0)

print("Yes")

Submission status: Accepted

Solution code:
S = input()
flag = 0
for i in range(1,len(S)+1):
    if i%2 == 1:
        if S[i-1] in 'RUD':
            continue
        else:
            flag =1
            print("No")
            break
    else:
        if S[i-1] in 'LUD':
            continue
        else:
            flag = 1
            print("No")
            break
if flag == 0:
    print("Yes")

Submission status: Accepted

Solution code:
S="*"+input()
N=len(S)-1

F=True
for i in range(1,N+1):
    if i%2==1:
        F&=S[i] in {"R","U","D"}
    else:
        F&=S[i] in {"L","U","D"}

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

howmany = len(s)
judge = "Yes"

for x in range(howmany):
  if x % 2 == 0:
    if s[x] != "R" and s[x] != "U" and s[x] != "D":
      judge = "No"
      break
  else:
    if s[x] != "L" and s[x] != "U" and s[x] != "D":
      judge = "No"
      break
      
print(judge)

Submission status: Accepted

Solution code:
#ABC141B
s = input()
print("Yes" if (s[::2].count("L")+s[1::2].count("R"))==0 else "No")

Submission status: Accepted

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

for i in range(len(s)):
    if  i%2==0:
        if s[i] not in odd:
            ans="No"
    else:
        if s[i] not in even:
            ans="No"

print(ans)

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"
print(ans)

Submission status: Accepted

Solution code:
S = input()
 
# Sの各文字は'L', 'R', 'U', 'D'のいずれかであることに注意する
# 1,3,...文字目が'L'でなく、偶数文字目が'R'でないとき 'Yes'とする
N = len(S)
ans = 'Yes'
for i in range(N):
  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 = input()
N = len(S)

# 1,3,...文字目が'R'でも'U'でも'D'でもない、または、2,4,...文字目が'L'でも'U'でも'D'でもないとき、'No'を出力する
ans = 'Yes'
for i in range(N):
  if (i % 2 == 0 and S[i] != 'R' and S[i] != 'U' and S[i] != 'D') or (i % 2 == 1 and S[i] != 'L' and S[i] != 'U' and S[i] != 'D'):
    ans = 'No'
    break
    
print(ans)

Submission status: Accepted

Solution code:
s=str(input())
d=True

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

Submission status: Accepted

Solution code:
S = list(input())
ans = True
for i in range(len(S)):
  if i % 2 != 0:
    if S[i] != "L" and S[i] != "U" and  S[i] != "D":
      ans = False
  else:
    if S[i] != "R" and S[i] != "U" and S[i] != "D":
      ans = False
if ans:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list_s = list(input())
for i in range(0, len(list_s)):
    if list_s[i] == 'U' or list_s[i] == 'D': continue
    elif (i % 2 == 0 and list_s[i] == 'R') or (i % 2 != 0 and list_s[i] == 'L'): continue
    else: print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
flag = 0
for i in S:
  if flag == 0:
    if i == 'L':
      print("No")
      exit()
  else:
    if i == 'R':
      print("No")
      exit()
  flag = 1 - flag
print("Yes")

Submission status: Accepted

Solution code:
#偶数と奇数配列に分ける
#奇数番配列にLが存在するかで条件分岐
#偶数番配列にRが存在するかで条件分岐
S = input()
Odd = S[::2]
Even = S[1::2]
print('Yes' if Odd.count('L') == 0 and Even.count('R') == 0 else 'No')

Submission status: Accepted

Solution code:
S = input()
flg = True
for i, s in enumerate(S):
    if i % 2 == 0:
        flg = flg & (s != 'L')
    elif i % 2 == 1:
        flg = flg & (s != 'R')
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
for i in s[::2]:
    if i == 'L':
        print('No')
        exit()
for j in s[1::2]:
    if j == 'R':
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
s=input()
o="RUD"
e="LUD"
for i in range(0,len(s),2):
    if s[i] not in o:
        print("No")
        exit()
for i in range(1,len(s),2):
    if s[i] not in e:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

S = input()
odd = set(['L','U','D'])
even = set(['R','U','D'])

for i in range(len(S)):
    if i%2 == 0:
        if S[i] not in even:
            print("No")
            exit(0)
    else:
        if S[i] not in odd:
            print("No")
            exit(0)

print("Yes")

Submission status: Accepted

Solution code:

S = input()

for i in range(len(S)):
    # 0オリジン[偶数]
    if i % 2 == 0:
        if S[i] not in ['R', 'U', 'D']:
            print("No")
            exit()
    else:
        if S[i] not in ['L', 'U', 'D']:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(N):
    if (i + 1) % 2 == 1:
        if S[i] in ("R", "U", "D"):
            continue
        else:
            print("No")
            exit()
    else:
        if S[i] in ("L", "U", "D"):
            continue
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
Odd = ["R","U","D"]
Even = ["L","U","D"]
match = 0

S = input()

for i in range(len(S)):
    if (i+1) % 2 == 0 and S[i] in Even:
        match += 1
    elif (i+1) % 2 == 1 and S[i] in Odd:
        match += 1

if match == len(S):
    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()
for i in s[::2]:
    if i=="L":
        print("No")
        exit()
for i in s[1::2]:
    if i=="R":
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
is_easy = True

for i in range(len(S)):
    if i & 1 == 1 and S[i] == 'R':
        is_easy = False
        break
    if i & 1 == 0 and S[i] == 'L':
        is_easy = False
        break

print(['No', 'Yes'][is_easy])

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")
        exit()
print("Yes")