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()

flg = 1
for i, a in enumerate(s):
    if (i) % 2 == 0:
        if a == "L":
            flg = 0
    else:
        if a == "R":
            flg = 0

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

s = list(read())
flg = True
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":
            pass
        else:
            flg = False
    else:
        if s[i - 1] == "L" or s[i - 1] == "U" or s[i - 1] == "D":
            pass
        else:
            flg = False

if flg:
    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] == "R" or s[i] == "U" or s[i] == "D"):
        continue
    elif i % 2 == 1 and (s[i] == "L" or s[i] == "U" or s[i] == "D"):
        continue
    else:
        ans = "No"
        break
print(ans)

Submission status: Accepted

Solution code:
S = input()
flag = 1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

ans = 0
for i in range(len(S)):
    c = S[i]
    if ((i%2==1 and c=="R") or (i%2==0 and c=="L")):
        ans = 1
        break

print(["Yes", "No"][ans])

Submission status: Accepted

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

Submission status: Accepted

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


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
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

S = input()

def check(S):
    for i, s in enumerate(S):
        if i%2 == 0 and s == 'L':
            return False
        if i%2 == 1 and s == 'R':
            return False
    return True

if check(S):
    Yes()
else:
    No()

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()
ok = True
for i, si in enumerate(s):
    if i%2:
        if si == "R":
            ok = False

    else:
        if si == "L":
            ok = False

print("Yes" if ok else "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"
  elif i%2==1 and s[i]=="R":
    ans = "No"
    
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# coding: utf-8
# Your code here!

import sys
s=input()

for idx, i in enumerate(s):
    if idx % 2 == 0:
        if i not in ["R", "U", "D"]:
            print("No")
            sys.exit()
    else:
        if i not in ["L", "U", "D"]:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

count = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            count += 1
        else:
            break
    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            count += 1
        else:
            break

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

Submission status: Accepted

Solution code:
S=input()
S_odd=S[1::2]
S_even=S[0::2]
ans="Yes"
for s in S_odd:
  if s=="L" or s=="U" or s=="D":
    pass
  else:
    ans="No"
    break
for s in S_even:
  if s=="R" or s=="U" or s=="D":
    pass
  else:
    ans="No"
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)):
    if i%2 == 0:
        if S[i] != "R" and S[i] != "U" and S[i] != "D":
            print("No")
            exit()
    else:
        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 = list(input())
# s = ['R', 'U', 'D', 'L', 'U', 'D', 'R']
for i in range(len(s)):
    if (i + 1) % 2 == 0:
        if s[i] == 'R':
            print('No')
            sys.exit(0)
    else:
        if s[i] == 'L':
            print('No')
            sys.exit(0)
print('Yes')

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    s = list(input())
    aaa = ['R', 'U', 'D']
    bbb = ['L', 'U', 'D']

    flg = 1
    for i in range(len(s)):
        if i % 2:
            if s[i] not in bbb:
                flg = 0
        else:
            if s[i] not in aaa:
                flg = 0

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())
flg = True
for i in range(len(S)):
    if i%2==0:
        if S[i] not in {"R","U","D"}:
            flg = False
            break
    else:
        if S[i] not in {"L","U","D"}:
            flg = False
            break

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

Submission status: Accepted

Solution code:
S = list(input())

false_flag = 0
for i, char in enumerate(S):
    #print(i, char)
    if i % 2 == 0:
        if char == 'L':
            false_flag = 1
            break
    if i % 2 == 1:
        if char == 'R':
            false_flag = 1
            break

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

Submission status: Accepted

Solution code:
s=input();print(" YNeos"[set(s[::2])<=set("RUD")and set(s[1::2])<=set("LUD")::2])

Submission status: Accepted

Solution code:
s = input()
s_list1 = []
s_list2 = []
for i in range(len(s)):
    if (i+1)%2 == 0:
        s_list2.append(s[i:i+1])
    else:
        s_list1.append(s[i:i+1])
#print(s_list1)
#print(s_list2)
if s_list1.count("L") == 0 and s_list2.count("R") == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
for i, s in enumerate(S):
    if i%2 == 1 and s == 'R':
        print('No')
        break
    if i%2 == 0 and s == 'L':
        print('No')
        break
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()
    if i % 2 != 0:
        if s[i] == 'R':
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# abc141/abc141_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S = i2s()
    for s in S[1::2]:
        if s == 'R':
            print('No')
            return
    for s in S[0::2]:
        if s == 'L':
            print('No')
            return
    print('Yes')
    return

main()

Submission status: Accepted

Solution code:
S = input()

S1 = set(['R', 'U', 'D'])
S2 = set(['L', 'U', 'D'])
flag = 'Yes'
if not all(x in S1 for x in S[0::2]):
    flag = 'No'
if not all(x in S2 for x in S[1::2]):
    flag = 'No'
print(flag)

Submission status: Accepted

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

res=0
for i in range(n):
  if s[i]=="U" or s[i]=="D":
    1
  else:
    if i%2==1 and s[i]=="L":
      1
    elif i%2==0 and s[i]=="R":
      1
    else:
      res=1
print("Yes" if res == 0 else "No")

Submission status: Accepted

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+1)%2]):
    ans = "No"
    break
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
import sys

S = input()
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()

odd_strp = ['R','U','D']
even_step = ['L', 'U', 'D']

for ix, c in enumerate(S):
    if ix & 1:
        if c in even_step:
            pass
        else:
            print("No")
            exit()
    
    else:
        if c in odd_strp:
            pass
        else:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

flag = True
for i, si in enumerate(s):
    if (i+1) % 2 == 1:
        if not si in ["R", "U", "D"]:
            flag = False
            break
    else:
        if not si in ["L", "U", "D"]:
            flag = False
            break
        
if flag:
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:


s = input()


footable = True
for i,si in enumerate(s):

    if (i+1)%2!=0 :
        if si=='L':
            footable = False
            break
    else:
        if si=='R':
            footable = False
            break

print('Yes' if footable else "No")

Submission status: Accepted

Solution code:
S = str(input())
odd = "RUD"
even = "LUD"
frag = True
for i in range(len(S)):
    if i%2 == 0 and S[i] not in odd:
        frag = False
        break
    elif i%2 != 0 and S[i] not in even:
        frag = False
if frag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
    v = input().strip()
    for i in range(len(v)):
        if i % 2 == 0:
            if v[i] not in ('R', 'U', 'D'):
                print('No')
                return
        elif i % 2 == 1:
            if v[i] not in ('L', 'U', 'D'):
                print('No')
                return
    print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

flg = True
for i in range(len(s)):
  if( ( (i%2==0) and (s[i] == "L") ) or ( (i%2==1) and (s[i] == "R"))):
    flg = False
    break

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
S = readline().strip()
N = len(S)
if any([S[i] == 'L' for i in range(0, N, 2)]) or any([S[i] == 'R' for i in range(1, N, 2)]):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input()
flg = 1
for i in str:
  if(flg==1):
    if(i=="L"):
      print("No")
      flg = 2
      break;
  else:
    if(i=="R"):
      print("No")
      flg = 2
      break;
  flg *=-1
if(flg!=2):
  print("Yes")

Submission status: Accepted

Solution code:
ip = lambda : map(int, input().split())
# ##############
# N,K = ip()
S = input()
for i in range(1,1+len(S)):
    if (i%2==1 and S[i-1]=='L') or (i%2==0 and S[i-1]=='R'):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    S = input()
    for i, c in enumerate(S):
        if i % 2 == 1:
            if c not in list('LUD'):
                print('No')
                exit()
        else:
            if c not in list('RUD'):
                print('No')
                exit()
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def resolve():
  s = input()
  for i in range(len(s)):
      if (i+1) %2 == 0:
          if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
              print('No')
              return
      else:
          if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
              print('No')
              return

  print('Yes')
  return


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys

S = str(input())
odd = ["R","U","D"]
even = ["L","U","D"]
for i in range(len(S)):
    if (i+1) % 2 == 0:
        if S[i] not in even:
            print("No")
            sys.exit()
    else:
        if S[i] not in odd:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

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("No")
                exit()
    print("Yes")
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
gu = set(["R", "U", "D"])
ki = set(["L", "U", "D"])
print("Yes" if (set(S[::2]) <= gu) and (set(S[1::2]) <= ki) else "No")

Submission status: Accepted

Solution code:
S = input()

flag = True
if 'L' in S[::2] or 'R' in S[1::2]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

kisu = "RUD"
gusu = "LUD"

for i, s in enumerate(S):
    if s == "R":
        if i % 2 != 0:
            print("No")
            exit()
    elif s == "L":
        if i % 2 == 0:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
if all(c in 'RUD' for c in s[::2]) and all(c in 'LUD' for c 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 and S[i]=='L':
        print('No')
        break
    elif i%2==1 and S[i]=='R':
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
if len(s)==1:
  s+="U"
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: Accepted

Solution code:
S = input()
ans1 = True
for s in S[1::2]:
    if s not in ['L','U','D']:
        ans1 = False
        break
for s in S[0::2]:
    if s not in ['R','U','D']:
        ans1 = False
print("Yes" if ans1 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
isTappable = True
for i,e in enumerate(S):
    if i % 2 == 0:
        #奇数文字列目
        if e == 'L':
            isTappable = False
    else:
        if e == 'R':
            isTappable = False

if isTappable:
    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] != "R" and  S[i] !="U" and S[i] !="D":
            ans ="No"
    if i%2 != 0:
        if S[i] != "L" and  S[i] !="U" and S[i] !="D":
            ans ="No"
print(ans)

Submission status: Accepted

Solution code:
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


r = ["U", "D", "R"]
l = ["U", "D", "L"]
s = input()

ans = "Yes"
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in r:
            ans = "No"
    else:
        if s[i] not in l:
            ans = "No"
print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    s=input()
    hu="Yes"
    for i in range(len(s)):
        if s[i]=="L" and i%2==0:
            hu="No"
            break
        elif s[i]=="R" and i%2!=0:
            hu="No"
            break
    print(hu)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
res = "Yes"

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

Submission status: Accepted

Solution code:
S = input()
F = 'LR'
for i, s in enumerate(S):
  if s == F[i % 2]:
    print('No')
    break
else:
  print('Yes')

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:
import sys
S = input()

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

print('Yes')

Submission status: Accepted

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


def judge(s):
    for i, c in enumerate(s):
        if i % 2 == 0 and c == "L" or i % 2 == 1 and c == "R":
            return False
    return True


def main():
    s = input()
    print("Yes" if judge(s) else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input().strip()

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')

Submission status: Accepted

Solution code:
S=input()

arr=[]
for i in set(S[0::2]):
    arr.append(i in ['R', 'U', 'D'])
for j in set(S[1::2]):
    arr.append(j in ['L', 'U', 'D'])
print('Yes' if all(arr) else 'No')

Submission status: Accepted

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

flag = True
for i, s in enumerate(s):
  if (i+1) % 2 == 1:
    if s not in ki:
      flag = False
  else:
    if s not in gu:
      flag = False
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())

is_easy = True
for i in range(len(S)):
    if i % 2 == 1:
        if S[i] not in ['L', 'U', 'D']:
            is_easy = False
    if i % 2 == 0:
        if S[i] not in ['R', 'U', 'D']:
            is_easy = False

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

Submission status: Accepted

Solution code:
s = input()

for i, c in enumerate(s):
    if i % 2 == 0:
        if c not in {'R', 'U', 'D'}:
            print('No')
            break
    else:
        if c not in {'L', 'U', 'D'}:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:


import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
##############################

S = list(input().rstrip())
odd = S[::2]
even = S[1::2]

for c in odd:
    if c == 'R' or c == 'U' or c == 'D':
        pass
    else:
        print('No')
        exit()

for c in even:
    if c == 'L' or c == 'U' or c == 'D':
        pass
    else:
        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')
        exit()
    if i % 2 != 0 and S[i] == 'R':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
a = ['R', 'U', 'D']
b = ['L', 'U', 'D']

S = input()
for s in S[::2]:
    if s not in a:
        print('No')
        exit()
if len(S) > 1:
    for s in S[1::2]:
        if s not in b:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ans = 'Yes'
for idx, val in enumerate(S):
    if idx % 2 == 1:
        if val == 'R':
            ans = 'No'
    if idx % 2 == 0:
        if val == 'L':
            ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
i = 1
ok = True
for s in S:
    if i%2==1 and s == "L":
        ok = False
    elif i % 2 == 0 and s == "R":
        ok = False
    i += 1
print("Yes") if ok else print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    s = SI()

    odd = s[0::2]
    even = s[1::2]
    dprint(even, odd)
    if set(even) - set(['L', 'U', 'D']) == set() and set(odd) - set(['R', 'U', 'D']) == set():
        print('Yes')
    else:
        print('No')

solve()

Submission status: Accepted

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':
            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: Accepted

Solution code:
def main():
    S = 'T' + input()
    odd = ['R','U','D']
    even = ['L','U','D']
    for i in range(1,len(S)):
        if i % 2 == 0:
            if S[i] not in even:
                print('No')
                exit()
        if i % 2 == 1:
            if S[i] not in odd:
                print('No')
                exit()

    print('Yes')


main()

Submission status: Accepted

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

Submission status: Accepted

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