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:
D = list(input())

A, B = [D[i] for i in range(0, len(D), 2)], [D[i] for i in range(1, len(D), 2)]
iA,iB = list("RUD"),list("LUD")

for v in A:
    if v not in iA:
        print("No")
        exit(0)
for v in B:
    if v not in iB:
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
num=1
ans="No"

while True:
  word=S[0]
  if num%2==1 :
    if  (word=="R") or (word=="U") or (word=="D") :
      if len(S)==1 :
        ans="Yes"
        break
      S=S[1:]
      num+=1
      continue
  else:
    if (word=="L") or (word=="U") or (word=="D") :
      if len(S)==1 :
        ans="Yes"
        break
      S=S[1:]
      num+=1
      continue
  break
      
print(ans)

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in range(0,len(s),2):
    if s[i] == "L":
        count+=1
for j in range(1,len(s),2):
    if s[j] == "R":
        count +=1
if count >0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
i=0
for tmp in list(s):
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  else:
    if tmp in ['R','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  break
if x=='N':
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8

S = input()
odd = []
even = []
result = 'No'

S_list = list(S)

for i, s in enumerate(S_list):
    if (i + 1) % 2 == 0:
        even.append(s)
    else:
        odd.append(s)

if 'L' not in odd and 'R' not in even:
    result = 'Yes'

print(result)

Submission status: Accepted

Solution code:
#problem-B
S = input()
cnt = 0
for i in range(0,len(S),2):
    if S[i] == "L":
        cnt += 1
for i in range(1,len(S),2):
    if S[i] == "R":
        cnt += 1
print("Yes" if cnt==0 else "No")

Submission status: Accepted

Solution code:
s = str(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')
      exit()
  else:
    if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
      continue
    else:
      print('No')
      exit()
else:
  print('Yes')

Submission status: Accepted

Solution code:
import sys


def solve():
    step = input()
    
    for i in range(len(step)):
        if i % 2 == 0:
            if step[i] != 'R' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
        else:
            if step[i] != 'L' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
    
    print('Yes')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys


def solve():
    step = input()
    flag = True
    
    for i in range(len(step)):
        if i % 2 == 0:
            if step[i] != 'R' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
        else:
            if step[i] != 'L' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
    
    print('Yes')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
a = list(input())
i = 0
while True:
    odd = a[i]
    if odd == 'L':
        print('No')
        break
    i += 1
    if i == len(a):
        print('Yes')
        break
    even = a[i]
    if even == 'R':
        print('No')
        break
    i += 1
    if i == len(a):
        print('Yes')
        break

Submission status: Accepted

Solution code:
S = input()

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

flag = True
for i, e in enumerate(S):
  if i % 2 == 0:
    if e not in odd:
      flag = False
  else:
    if e not in even:
      flag = False
      
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a=input()
for i,k in enumerate(a):
  if i%2==0:
    if k=="L":
      print("No")
      exit()
  else:
    if k=="R":
      print("No")
      exit()
      
print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#https://atcoder.jp/contests/abc141/tasks/abc141_a
import sys
#import collections

#n= int(input())
s= input()
#tmp = input().split()
#a = list(map(lambda a: int(a), tmp))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True and isEven == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""Untitled1.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1sPHBzfvofvfL_Ijx8PVG08rBK-9-M_-6
"""

import sys

Weather = input()

def Odd(x) :
  if x == 'L' :
    return True

def Even(x) :
  if x == 'R' :
    return True

def Step(Weather) :
  k =1
  for x in Weather :
    if k%2 ==1:
      if Odd(x) :
        break
      k+=1
    else:
      if Even(x) :
        break
      k+=1
  if k >len(Weather) :
    return True
  else :
    return False

if Step(Weather):
  print('Yes')
else :
  print('No')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S=input()

ans="Yes"

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

for i in range(len(S)):
    if i%2==0 and S[i] in odd:
        continue
    elif i%2!=0 and S[i] in even:
        continue
    else:
        ans="No"
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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
  
  if len(s)-1 == i:
    print('Yes')

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

flg = 0
for i, c in enumerate(s):
  if i%2!=0:
    if c in ["L", "U", "D"]:
      continue
    else:
      flg = 1
      break
  else:
    if c in ["R", "U", "D"]:
      continue
    else:
      flg = 1
      break

ans = "Yes" if not flg else "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

if 'L' in odd or 'R' in even:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

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

check = 0
for i in range(len(S)):
    if S[i] == 'L' or  S[i] ==  'R' or S[i] == 'U' or S[i] == 'D':
        check += 0
    else:
        check += 1

if 1 <= len(S) <= 100 and check==0:
    pass
else:
    print('EROOR')
    S = str(input())

RUD = 0
LUD = 0

for i in range(0,len(S),2):
    if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
        RUD += 0
    else:
        RUD += 1
        
for i in range(1,len(S),2):
    if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
        LUD += 0
    else:
        LUD += 1

if RUD == 0 and LUD == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = False

for i in range(len(S)):
    if i % 2 == 0: # 奇数番目
        if S[i] == 'L':
            flag = True
            break
    else: # 偶数番目
        if S[i] == 'R':
            flag = True
            break

if flag:
    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] == "R" or s[i] == "U" or s[i] == "D":
            ans = "Yes"
        else:
            ans = "No"
            break
    elif i%2 == 1:
        if s[i] == "L" or s[i] == "U" or s[i] == "D":
            ans = "Yes"
        else:
            ans = "No"
            break

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
import sys

s = input()

rud1 = ["R","U","D"]
lud2 = ["L","U","D"]


for val in range(0,len(s),2):
    if s[val] not in rud1:
        print("No")
        sys.exit(0)

for val in range(1,len(s),2):
    if s[val] not in lud2:
        print("No")
        sys.exit(0)
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a=list(input())
i=0
while i<len(a):
    if(i%2==0):
        if a[i]=='L':
            print('No')
            sys.exit()
    else:
        if a[i]=='R':
            print('No')
            sys.exit()
    i+=1
print('Yes')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
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()
ans = 'Yes'
for i, str in enumerate(s):
    if i % 2 == 0:
        if str not in 'RUD':
            ans = 'No'
            break
    else:
        if str not in 'LUD':
            ans = 'No'
            break
print(ans)

Submission status: Accepted

Solution code:
c=input()
test='Yes'
for i in range (len(c)) :
    if( i % 2) ==0 :
        if not (c[i] in 'URD') :
            test = 'No'
            break
    else :
        if not (c[i] in 'ULD') :
            test = 'No'
            break
print( test)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
k = ''
g = ''
for i, s in enumerate(S):
    if i % 2 == 0:
        k += s
    else:
        g += s

if 'L' not in k and 'R' not in g:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

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

#文字列を1文字ずつ分けたいときは、listをつかう！

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

Submission status: Accepted

Solution code:
# get input parameter
step_list = list(input())

# continue flag
isEasy = True

# loop operation
for index in range(len(step_list)):
    num = index + 1
    item = step_list[index]
    
    if (item == 'R'):
        if (num % 2 == 0):
            isEasy = False
    elif (item == 'L'):
        if (num % 2 == 1):
            isEasy = False
    
    if not isEasy:
        break

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

Submission status: Accepted

Solution code:
S = list(input())

i = 0
while i < len(S):
    if i % 2 == 0 and S[i] in ["R", "U", "D"]:
        i += 1
        continue
    elif i % 2 == 1 and S[i] in ["L", "U", "D"]:
        i += 1
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

odd_set = set(["R", "U", "D"])
even_set = set(["L", "U", "D"])

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

Submission status: Accepted

Solution code:
import re

s = input()

pattern = re.compile(r'^([^L][^R])*[^L]?$')
is_easy_to_dance = pattern.match(s)

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

Submission status: Accepted

Solution code:
ans = True
for i, c in enumerate(input()):
  if i%2:
    if c not in ['L', 'U', 'D']:
      ans = False
  else:
    if c not in ['R', 'U', 'D']:
      ans = False
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    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")


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

odd_check = ('R', 'U', 'D')
even_check = ('L', 'U', 'D') 

s = input()
s = list(s)

roop_count = 1

for i in s:
    if roop_count % 2 != 0:
        if i in odd_check:
            roop_count += 1
            pass
        else:
            print('No')
            exit()
    
    else:
        if i in even_check:
            roop_count += 1
            pass
        else:
            print('No')
            exit()
            

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dance=input()
char=list(dance)
swt=0
#odd
for i in range((len(dance)+1)//2):
    #print(i)
    if (char[2*i] == "L"):
        swt += 1
#even
for i in range(len(dance)//2):
    #print(i)
    if(char[2*i+1] == "R"):
        swt += 1

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

Submission status: Accepted

Solution code:
# ABC 141 - Tap Dance

import sys

S = input()

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

print('Yes')

Submission status: Accepted

Solution code:
s=list(input())
if(all((x!='R' for x in s[1::2])) and all((x!='L' for x in s[::2]))):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=str(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==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

for c in range(1,len(S)+1):
    if c%2==1: 
        if S[c-1] == 'L':
            print('No')
            break
    else:
        if S[c-1] == 'R':
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

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

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = input()

odd = list(string[0::2])
even = list(string[1::2])

odd_if = set(odd) <= {'R', 'U', 'D'}
even_if = set(even) <= {'L', 'U', 'D'}

if odd_if and even_if:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

S = input()

for i in range(len(S)):
    #奇数番目の文字
    if i % 2 == 0:
        if not (S[i] == 'R' or S[i] == 'U' or S[i] == 'D'):
            print('No')
            exit()
    #偶数番目の文字
    else:
        if not (S[i] == 'L' or S[i] == 'U' or S[i] == 'D'):
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
S = list(input())


def dance_checker(S):
    N = len(S)
    for i in range(N):
        if i % 2 == 0:
            if S[i] == "L":
                return("No")
        else:
            if S[i] == "R":
                return("No")

    return("Yes")


print(dance_checker(S))

Submission status: Accepted

Solution code:
import sys
odd = 'RUD'
even = 'LUD'
step = input()
odd_step = step[0::2]
even_step = step[1::2]
for o in odd_step:
    if not o in odd:
        print('No')
        sys.exit(0)
for e in even_step:
    if not e in even:
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())

r = [i for i, x in enumerate(S) if (x == 'R' and (i+1) % 2 == 0) or (x == 'L' and (i+1) % 2 != 0)]

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

Submission status: Accepted

Solution code:
import math
import queue

mod = 1e9+7

def swap(a,b):
    return (b,a)

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

def divisors(a):
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def main():
    s = input()
    ans = "Yes"
    for i in range(len(s)):
        if i%2==0:
            if s[i]=="L":
                ans = "No"
        else:
            if s[i]=="R":
                ans = "No"
    print(ans)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

S = str(input())
ans = True
for i,s in enumerate(S):
    if i % 2 == 0 and s == "L" or i % 2 == 1 and s == "R":
        ans = False

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

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()
flag=1
for i in s[0::2]:
    if not (i in "RUD"):
        flag=0
for i in s[1::2]:
    if not (i in "LUD"):
        flag=0
if flag:
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
x = list(input())
i = 0
edetector = True
odetector = True
while i < len(x):
    if  i % 2 == 0:
        if not x[i] in ["R", "U", "D"]:
            edetector = False
    else:
        if not x[i] in ["L", "U", "D"]:
            odetector = False
    i += 1

if edetector and odetector:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

result = True
for i in range(0, len(s), 2):
  if s[i] == 'L':
    result = False
    break
    
if result:
  for i in range(1, len(s), 2):
    if s[i] == 'R':
      result = False
      break

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

Submission status: Accepted

Solution code:
S = list(input())
count = 0
for i in S:

  if count == 0:
    if i == "L":
      print("No")
      exit()
    count += 1
  else:
    if i == "R":
      print("No")
      exit()
    count -= 1
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

print (result)

Submission status: Accepted

Solution code:
s = list(input())

for i in range(len(s)): # start from 0
  if ((i+1)%2 == 0) and s[i] == "R": #Even
    print("No")
    exit()
  elif ((i+1)%2 == 1) and s[i] == "L": #Odd
    print("No")
    exit()

    
print("Yes")

Submission status: Accepted

Solution code:
from sys import exit

s = input()

for i, c in enumerate(s):
    if i % 2 == 0 and c not in 'RUD':
        print('No')
        exit(0)
    elif i % 2 == 1 and c not in 'LUD':
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
s_ever = []
s_odd = []
for i in range(len(s)):
  if i % 2 != 0:
    s_ever.append(s[i])
  else:
    s_odd.append(s[i])
if "L" not in s_odd and "R" not in s_ever:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
s = input()

kisu = ["R", "U", "D"]
gusu = ["L", "U", "D"]

flag = True

for i in range(len(s)):
    if (((i + 1) % 2 == 0) and not s[i] in gusu) or (((i + 1) % 2 == 1) and not s[i] in kisu):
        flag = False
        break

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

Submission status: Accepted

Solution code:
s=input()

sl=list(s)

kisu=["R","U","D"]
gusu=["L","U","D"]
flag=True

for i in range(1,len(sl)+1):
  st=sl[i-1]
  if i % 2 ==0 :
    if not st in gusu :
      flag=False
      break
  else :
    if not st in kisu :
      flag=False
      break
if flag :
  print("Yes")
else :
  print("No")

Submission status: Accepted

Solution code:
def tap_dance(st):
  size = len(st)
  for i in range(size):
    if (i+1) % 2 == 0:
      if st[i] not in "LUD":
        return "No"
    else:
      if st[i] not in "RUD":
        return "No"
  return "Yes"
st = input()
print(tap_dance(st))

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=str(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 = open(0).read()
if 'L' not in s[::2] and 'R' not in s[1::2]:
    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")
            exit()
    else:
        if c not in ["L", 'U', 'D']:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

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


def main():
    s = list(input())
    odd = s[::2]
    even = s[1::2]

    if 'L' not in odd and 'R' not in even:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
cnt=1
for i in s:
  if cnt%2==1:
    if i =="L":
      print("No")
      exit()
  if cnt%2==0:
    if i =="R":
      print("No")
      exit()
  cnt+=1
print("Yes")

Submission status: Accepted

Solution code:
S = input()
count = 0
for letter in S:
    count += 1
    if count % 2 == 1 and letter == "L":
        print("No")
        count -=1
        break
    elif count % 2 == 0 and letter == "R":
        print("No")
        count -=1
        break
if count == len(S):
    print("Yes")

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    
    odd_s = s[0::2]
    even_s = s[1::2]
    
    if "L" not in odd_s and "R" not in even_s:
        print("Yes")
    else:
        print("No")
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
flag = 0
for index, word in enumerate(S):
    if (word == 'U' or word == 'D') or (index%2 == 1 and word == 'L') or (index%2 == 0 and word == 'R'):
        pass
    else:
        flag = 1
        break;
print('Yes' if flag ==0 else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a = "No"

if {"R","U","D"} >= set(list(s[0::2])):
  if {"L","U","D"} >= set(list(s[1::2])):
  	a = "Yes"

print(a)

Submission status: Accepted

Solution code:
s=input()

if {"R","U","D"} >= set(list(s[0::2])) and {"L","U","D"} >= set(list(s[1::2])):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=input()

k_s = set(list(s[0::2]))
g_s = set(list(s[1::2]))

if {"R","U","D"} >= k_s and {"L","U","D"} >= g_s:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()

flag = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] != "R" and S[i] != "U" and S[i] != "D":
            flag = 0
    else:
        if S[i] != "L" and S[i] != "U" and S[i] != "D":
            flag = 0
    if flag == 0:
        break
if flag == 1:
    print("Yes")
else:
    print("No")