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()
Odd=S[::2]
Even=S[1::2]

X=0
import math
for i in range(math.ceil(len(S)/2)):
    if Odd[i]=="L":
        X+=1

for i in range(len(S)//2):
    if  Even[i]=="R":
        X+=1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

flag=True

for i in range(len(s)):
    if s[i]=='R':
        if (i+1)%2==0:
            flag=False
            break
    if s[i]=='L':
        if (i+1)%2!=0:
            flag=False
            break

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

Submission status: Accepted

Solution code:
S = str(input())
o = ["L","U","D"]
e = ["R","U","D"]

ans = 1
for i, s in enumerate(S):
  if (i+1) % 2 == 0:
    if s not in o:
      ans = 0
      break
  else:
    if s not in e:
      ans = 0
      break
if ans:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

f = True

for i in range(0, n, 2):
  if s[i] == 'L':
    f = False

for i in range(1, n, 2):
  if s[i] == 'R':
    f = False
    
print("Yes" if f else "No")

Submission status: Accepted

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

for i in range(N):
    if i&1:
        if S[i]=='R':
            print('No')
            exit()
    else:
        if S[i]=='L':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s=list(map(str,input()))
for i in range(len(s)):
    if i%2==0 and s[i]=='L':
        print('No')
        sys.exit()
    else:
        if i%2==1 and s[i]=='R':
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
S=input()
S1=S[::2]
S2=S[1::2]
for i in S1:
    if i == "L":
        print("No")
        exit(0)
for i in S2:
    if i =="R":
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

Solution code:
s = input()

even_list = [s[i] for i in range(len(s)) if i % 2 == 0]
odd_list = [s[i] for i in range(len(s)) if i % 2 != 0]

a = set(["R", "U", "D"])
b = set(["L", "U", "D"])

if set(even_list) | a == a and set(odd_list) | b == b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = input()
for i,j in enumerate(s):
    if i%2==0 and j=='L':
        print('No')
        sys.exit()
    elif i%2==1 and j=='R':
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
b=True
for x in range(len(s)):
    if (x+1)%2==1:
       if s[x] not in ["R","U","D"]:b=False
    else:
       if s[x] not in ["L","U","D"]:b=False
if b:print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
s=input()
kisu = s[::2]
gusu = s[1::2]
for i in range(len(kisu)):
  if kisu[i] == "L":
    print("No")
    exit()
for i in range(len(gusu)):
  if gusu[i] == "R":
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()

yes = True
for i in range(len(s)):
  if s[i] == 'U' or s[i] == 'D':
    continue
  if i % 2 != 0:
    if s[i] == 'L':
      continue
    else:
      yes = False
      break
  else:
    if s[i] == 'R':
      continue
    else:
      yes = False
      break

if yes:
  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"
            break
    else:
        if S[i] == 'R':
            ans = "No"
            break
print(ans)

Submission status: Accepted

Solution code:
S = raw_input()

ans = "Yes"
for i in range(len(S)):
  if not (i%2==0 and S[i] in "RUD" or i%2!=0 and S[i] in "LUD"):
    ans = "No"
print ans

Submission status: Accepted

Solution code:
S = input()
listkisuu = ['R','U','D']
listguusuu = ['L','U','D']

fumizuraiflg = 0

for i in range(len(S)):
    #奇数の時
    if (i+1) % 2 != 0:
        if S[i] not in listkisuu:
            fumizuraiflg = 1
    #偶数の時
    else:
        if S[i] not in listguusuu:
            fumizuraiflg = 1        
print('Yes' if fumizuraiflg == 0 else 'No')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()
l = {"R":1,"L":2,"U":3,"D":4}

ans = "Yes"
for i,c in enumerate(s):
    if i%2 == 0 and c == "L":
        ans = "No"
    elif i%2 != 0 and c == "R":
        ans = "No"
        
print(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:
s=str(input())

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

print ("No" if count==1 else "Yes")

Submission status: Accepted

Solution code:
import sys

s=str(input())

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
odd = []
even = []
for i in range(len(s)):
  if i % 2 == 0:
    odd.append(s[i])
  else:
    even.append(s[i])
if "L" in odd or "R" in even:
  print("No")
else:
  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:
o = set(["R", "U", "D"])
e = set(["L", "U", "D"])

s = input()

if set(s[::2]) <= o and set(s[1::2]) <= e:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
li = list(input())

lik = li[1::2]
lig = li[0::2]
a = 0
b = 0


if 'L' in lig:
    a = a + 1

if 'R' in lik:
    b = b + 1

if a + b == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
rtu = "Yes"
ks = 1
for i in S:
    if ks == 1:
        if i == "L":
            rtu = "No"
            ks = 0
            break
        else:
            ks = 0
    elif ks == 0:
        if i == "R":
            rtu = "No"
            ks = 1
            break
        else:
            ks = 1
print(rtu)

Submission status: Accepted

Solution code:
s=str(input())
a,b=s[::2],s[1::2]
c=any(l=="L" for l in a) | any(l=="R" for l in b)
print("Yes" if not c else "No")

Submission status: Accepted

Solution code:
N = list(input())
N.insert(0, '')
even = N[2::2]
odd = N[1::2]
if ('R' in even or 'L' in odd):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
#141 b
ki=["R","U","D"]
gu=["L","U","D"]
s=input()
ans=True
i=1
for c in s:
    if ans==False:
        break
    if i%2==1:
        if c not in ki:
            ans=False
    if i%2==0:
        if c not in gu:
            ans=False
    i+=1
print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
def solve(inp):
    S = inp.readline().strip()

    for i in range(0, len(S), 2):
        if S[i] == 'L':
            return 'No'
    for i in range(1, len(S), 2):
        if S[i] == 'R':
            return 'No'

    return 'Yes'


def test(s):
    from io import StringIO
    print(solve(StringIO(s)))


def main():
    import sys
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    # test('')
    main()

Submission status: Accepted

Solution code:
import itertools
a=list(input())
ans="Yes"
for i,j in enumerate(a):
  if i%2==0:
    if not(j=="R" or j=="U" or j=="D"):
      ans="No"
  else:
    if not (j=="L" or j=="U" or j=="D"):
      ans="No"
print(ans)

Submission status: Accepted

Solution code:
S = list(input())

odd_taps = S[0::2]
even_taps = S[1::2]

if 'L' not in odd_taps and 'R' not in even_taps:
    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 (i%2==0 and S[i]=='L'):
    ans='No'
print(ans)

Submission status: Accepted

Solution code:
# h,w = map(int,input().split())
S = input()
len_s = len(S)
ans = 'Yes'

# 奇数
for x in range(0,len_s,2):
  target = S[x]
  if target == 'L':
    ans = 'No'
  
# 偶数
for x in range(1,len_s,2):
  target = S[x]
  if target == 'R':
    ans = 'No'

print(ans)

Submission status: Accepted

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

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

def solve(S: str):
    n = 0
    d = False
    for i in range(1,len(S)+1):
        if i % 2 == 1:
            if not ( S[i-1] == "R" or 
               S[i-1] == "U" or 
               S[i-1] == "D"):
                d = True
                break
        else:
            if not ( S[i-1] == "L" or 
               S[i-1] == "U" or 
               S[i-1] == "D"):
                d = True
                break

    if d:
        print(NO)
    else:
        print(YES)

    return

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()
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()
k = len(S)
ans = "Yes"

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
flag = 1
for i in range(n):
    if (i % 2 == 0) and (s[i] not in {'R', 'U', 'D'}):
        flag = 0
    if (i % 2 == 1) and (s[i] not in {'L', 'U', 'D'}):
        flag = 0

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

Submission status: Accepted

Solution code:
s = input()

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

isYes = True

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odd:
            isYes = False
            break
    elif i % 2 != 0:
        if s[i] not in even:
            isYes = False
            break

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

Submission status: Accepted

Solution code:
def good(i, s):
    if i % 2 == 1:
        return s in ["R", "U", "D"]
    else:
        return s in ["L", "U", "D"]


S = input()

if all(good(i, s) for i, s in enumerate(S, 1)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    S = input()
    
    for i in range(len(S)):
        if not i % 2:
            if S[i] == "R" or S[i] == "U" or S[i] == "D":
                continue
            else:
                print("No")
                exit()
        else:
            if S[i] == "L" or S[i] == "U" or S[i] == "D":
                continue
            else:
                print("No")
                exit()
    print("Yes")




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#141

s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

if all([e in even for i, e in enumerate(S) if (i + 1) % 2 == 0]) and \
   all([o in odd for i, o in enumerate(S) if (i + 1) % 2 == 1]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = str(input())

for count in range(1,len(S)+1):
    if count % 2 == 1:
        if S[count-1] == "R" or S[count-1] == "U" or S[count-1] == "D":
            flag = False
        else:
            flag = True
            break
    else:
        if S[count-1] == "L" or S[count-1] == "U" or S[count-1] == "D":
            flag = False
        else:
            flag = True
            break

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

Submission status: Accepted

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

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:
#  AtCoder Beginners Contest 141 - B
# -*- encoding: UTF-8 -*-
slist = list(input())

result = "Yes"

while len(slist) > 0 :
  s1 = slist.pop(0)
  if s1 == "L" :
    result = "No"
    break
  if len(slist) > 0:
    s2 = slist.pop(0)
    if s2 == "R":
      result = "No"
      break

print(result)

Submission status: Accepted

Solution code:
# ABC 141 B

S = input()
res = 'Yes'

for i in range(len(S)):
    if (i + 1) % 2 == 0: # even
        if S[i] == 'R':
            res = 'No'
            break
    else: # odd
        if S[i] == 'L':
            res = 'No'
            break

print(res)

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 != 0 and s[i] == "R":
        flag = True
if flag == False:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

eList = []
oList = []
for i in range(len(s)):
  if (i+1) % 2 == 0:
    eList.append(s[i])
  else:
    oList.append(s[i])

if eList.count('R') > 0 or oList.count('L') > 0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
odd = {"R", "U", "D"}
even = {"L", "U", "D"}
check = True

s = input()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odd:
            check = False
    else:
        if s[i] not in even:
            check = False

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

Submission status: Accepted

Solution code:
s = input()

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

print("Yes")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    for i, c in enumerate(s):
        if (i + 1) % 2 == 0:
            pushable = 'LUD'
        else:
            pushable = 'RUD'
        if c not in pushable:
            print('No')
            return
    print('Yes')


main()

Submission status: Accepted

Solution code:
S=str(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()
re=0
for i in range(len(s)):
    if i%2==0 and s[i]=='L':
        re=1
    if i%2!=0 and s[i]=='R':
        re=1
if re==1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = list(map(str, input()))
count1 = 0
count2 = 1
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count1 +=2
else:
    while count2 < len(S):        
        if S[count2] == 'R':
            print('No')
            break
        else:
            count2 += 2
    else:
        print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

result = 'Yes'
for i in range(len(s)):
    if i % 2 == 0 and s[i] == 'L': # odd
        result = 'No'
    elif i % 2 == 1 and s[i] == 'R': # even
        result = 'No'

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def ABC141B():
    S = input()

    for i, s in enumerate(S):
        if i % 2 == 0:
            if s == 'L':
                print('No')
                return()
        else:
            if s == 'R':
                print('No')
                return()

    print('Yes')
    return()

ABC141B()

Submission status: Accepted

Solution code:
S = input()
easy_in_odd = ["R", "U", "D"]
easy_in_even = ["L", "U", "D"]
is_easy = True
count = 1
for move in list(S):
    if count % 2 == 1 and move not in easy_in_odd:
        is_easy = False
        break
    elif count % 2 == 0 and move not in easy_in_even:
        is_easy = False
        break
    count += 1

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

Submission status: Accepted

Solution code:
cond1 = ['R','U','D']
cond2 = ['L','U','D']

S = list(input())

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

Submission status: Accepted

Solution code:
S = input()

if "L" in S[::2] or "R" in S[1::2]:
 print("No")
else:
 print("Yes")

Submission status: Accepted

Solution code:
s = input()

ng = 0

for c in s[::2]:
  if c not in 'RUD':
    ng = 1
    break
for c in s[1::2]:
  if c not in 'LUD':
    ng = 1
    break

print('Yes' if ng == 0 else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
n = len(S)
check = True
if n%2 == 0:
  for i in range(n//2):
    if not (S[2*i]=="R" or S[2*i]=="U" or S[2*i]=="D"):
      check = False
  for i in range(n//2):
    if not (S[2*i+1]=="L" or S[2*i+1]=="U" or S[2*i+1]=="D"):
      check = False
if n%2 != 0:
  for i in range((n+1)//2):
    if not (S[2*i]=="R" or S[2*i]=="U" or S[2*i]=="D"):
      check = False
  for i in range((n-1)//2):
    if not (S[2*i+1]=="L" or S[2*i+1]=="U" or S[2*i+1]=="D"):
      check = False
if(check):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
 
oddStep = ['R','U','D']
evenStep = ['L','U','D']
CNST_NO = 'No'
CNST_YES = 'Yes'
good_step = CNST_YES
 
for i in range( len( s ) ):
  if i % 2 == 1: # 0 start
    if not ( s[ i ] in evenStep ):
      good_step = CNST_NO
  else:
    if not( s[ i ] in oddStep ):
      good_step = CNST_NO
  if good_step == CNST_NO:
    break
print( good_step )

Submission status: Accepted

Solution code:
s = input()
N = len(s)
a = 0
for x in range(0,N,2):
    if s[x] == "L":
        a = 1
for x in range(1,N,2):
    if s[x] == "R":
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

x = s[0::2]
y = s[1::2]
if ('L' in x or 'R' in y):
   print('No')
else:
   print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
counter = 1
anscount = 1
for i in S:
  if counter % 2 == 1:
    if i == 'R' or i == 'U' or i == 'D':
      anscount += 1
  if counter % 2 == 0:
    if i == 'L' or i == 'U' or i == 'D':
      anscount += 1
  counter += 1
if counter == anscount:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S=input()
K=[]
G=[]
for i in range(0,len(S),2):
  K.append(S[i])
  try:
    G.append(S[i+1])
  except:
    pass
if ('L' in K) or ('R' in G):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
a = input()
li = list(a)
judge = 'Yes'

for i in range(len(a)):
  if (i+1)%2 == 0 and li[i] == 'R':
    judge = 'No'
  if (i+1)%2 == 1 and li[i] == 'L':
    judge = 'No'
    
print(judge)

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:
def main():
    s = input()

    odd = 1
    even = 1

    for i in range(1,len(s)+1):
        if i % 2 == 0:
            if s[i-1] == 'R':
                odd = 0
        else:
            if s[i-1] == 'L':
                even = 0

    if odd == 1 and even == 1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
odd_step=["R","U","D"]
even_step=["L","U","D"]

s=input()

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

Submission status: Accepted

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

S = input()

odd = []
even = []

for i in range(len(S)) : 
    if i % 2 == 0 : 
        odd.append(S[i])
    else : 
        even.append(S[i])
        
flag = 1

for i in odd : 
    if i != "R" and i != "U" and i != "D" : 
        flag = 0
        break
    
if flag != 0 : 
    for i in even : 
        if i != "L" and i != "U" and i != "D" : 
            flag = 0
            break
        
if flag == 1 : 
    print("Yes")
else : 
    print("No")

Submission status: Accepted

Solution code:
S = list(input())

res = True
for i, s in enumerate(S, 1):
    if i % 2 == 0:
        if s not in ['L', 'U', 'D']:
            res = False
    else:
        if s not in ['R', 'U', 'D']:
            res = False

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

Submission status: Accepted

Solution code:
s = input()

no = []
for i, ss in enumerate(s):
    if ((i + 1) % 2 == 0 and ss in ('L','U','D')) or ((i + 1) % 2 != 0 and ss in ('R', 'U', 'D')):
        pass
    else:
        no.append(ss)

if len(no) == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
flag = False

for i, m in enumerate(S):
    # 'Odd' index
    if i % 2 == 0 and m == 'L':
        print('No')
        flag = True
        break
    # 'Even' index
    elif i % 2 == 1 and m == 'R':
        print('No')
        flag = True
        break
    else:
        continue

if not flag:
    print('Yes')

Submission status: Accepted

Solution code:
print(['No','Yes'][all([a in('RUD','LUD')[i%2]for i,a in enumerate(input())])])

Submission status: Accepted

Solution code:
def main():
    S = str(input())

    count = 0
    for s in S:
        if count == 0:
            count = 1
            if (s != "R") & (s != "U") & (s != "D"):
                return "No"
        else:
            count = 0
            if (s != "L") & (s != "U") & (s != "D"):
                return "No"
    return "Yes"

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

Submission status: Accepted

Solution code:
A = list(input())
B=[]
C=[]

for i in range(1,len(A),2):
  B.append(A[i])
for i in range(0,len(A),2):
  C.append(A[i])
B=set(B)
C=set(C)

if {'D', 'U', 'L'} >= B and {'D', 'U', 'R'} >= C:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().decode('utf8').rstrip()
flag1 = True
flag2 = True
Sodd = S[::2]
Seven = S[1::2]

if Sodd.count('L') != 0:
    flag1 = False
if Seven.count('R') != 0:
    flag2 = False

print('Yes' if flag1 and flag2 else 'No')

Submission status: Accepted

Solution code:
S = list(input())
n = len(S)
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
ans = "Yes"

for i in range(1, n+1):
    if i % 2 == 0:
        if not S[i-1] in even:
            ans = "No"
            break
        else:
            continue
    else:
        if not S[i-1] in odd:
            ans = "No"
            break
        else:
            continue

print(ans)

Submission status: Accepted

Solution code:
k = ['R','U','D']
g = ['L','U','D']

s = input()
for i in range(len(s)):
  if s[i] == 'U' or s[i] == 'D':
    continue
  else:
    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()
l = list(S)

#odd loop
for i in range(0, len(l), 2):
    if l[i] == 'L':
        print('No')
        exit()

#even loop
for j in range(1, len(l), 2):
    if l[j] == 'R':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()

#odd loop
for i in S[::2]:
    if i == 'L':
        print('No')
        exit()
#even loop
for j in S[1::2]:
    if j == 'R':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()
s1 = s[::2]
s2 = s[1::2]

if 'L' in s1 or 'R' in s2:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = 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()

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