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 = ["R", "U", "D"]
even = ["L", "U", "D"]

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t=input()
ans = ""
for i in range(len(t)):
    if (i % 2 == 1) and (t[i] == "R"):
        ans = "No"
        break
    elif (i % 2 == 0) and (t[i] == "L"):
        ans = "No"
        break

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

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    odd_list=['R', 'U', 'D']
    eve_list=['L', 'U', 'D']
    odd = S[0::2]
    eve = S[1::2]
    for i in odd:
        if i not in odd_list:
            print('No')
            return
    for i in eve:
        if i not in eve_list:
            print('No')
            return
    print('Yes')

main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    odd_list=['R', 'U', 'D']
    eve_list=['L', 'U', 'D']
    odd = S[0::2]
    eve = S[1::2]
    for i in odd:
        if i not in odd_list:
            print('No')
            return
    for i in eve:
        if i not in eve_list:
            print('No')
            return
    print('Yes')

main()

Submission status: Accepted

Solution code:
N = input()
 
print("No" if "L" in N[::2] or "R" in N[1::2] else "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()
sl = list(s)
for i in range(len(sl)):
    if (i + 1) % 2 == 1:
        if sl[i] == 'L':
            print('No')
            break
        else:
            continue
    else:
        if sl[i] == 'R':
            print('No')
            break
        else:
            continue
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = list(input())
    for i in range(len(s)):
        if s[i] == 'U' or s[i] == 'D':
            pass
        elif i % 2 == 0 and s[i] == 'R':
            pass
        elif i % 2 == 1 and s[i] == 'L':
            pass
        else:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = str(input())
count = 0
a = ["R", "U", "D"]
b = ["L", "U", "D"]
for i in s[::2]:
    if i in a:
        pass
    else:
        count = 1
        break
for i in s[1::2]:
    if i in b:
        pass
    else:
        count = 1
        break
print("Yes" if count == 0 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:
S = input()
A = ['R', 'U', 'D']
B = ['L', 'U', 'D']
for i,j in enumerate(S):
    if((i+1)%2==0):
        if( j not in B):
            print('No')
            exit()
    else:
        if(j not in A):
            print('No')
            exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

odd  = [ (c in 'RUD') for i, c in enumerate(s) if i % 2 == 0 ]
even = [ (c in 'LUD') for i, c in enumerate(s) if i % 2 == 1 ]

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    nagasa = len(s)

    for i in range(nagasa):
        if i % 2 == 0 and s[i] == "L":
            print("No")
            exit()
        elif i % 2 != 0 and s[i] == "R":
            print("No")
            exit()
    print("Yes")

    
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    
    odd = {'R', 'U', 'D'}
    even = {'L', 'U', 'D'}
    
    ans = 'Yes'
    for i, c in enumerate(S):
        if not i % 2 and c not in odd:
            ans = 'No'
        elif i % 2 and c not in even:
            ans = 'No'
    
    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())
S_odd=S[::2]
S_even=S[1::2]
flag=1
for i in S_odd:
    if i != "R" and i != "U" and i != "D":
        print("No")
        exit(0)
    for j in S_even:
        if j != "L" and j != "U" and j != "D":
            print("No")
            exit(0)
print("Yes")

Submission status: Accepted

Solution code:
S=input()

if all(a!="L" for a in S[::2]) and all(a!="R" for a in S[1::2]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
val = True
for i in range(1, len(S) + 1):
    if i % 2 and (S[i - 1] in ['R', 'U', 'D']):
        pass
    elif i % 2 == 0 and (S[i - 1] in ['L', 'U', 'D']):
        pass
    else:
        val = False
    if not val:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

main()

Submission status: Accepted

Solution code:
s = input()
k = 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:
            k = False
            break
    elif i % 2 == 0:
        if s[i-1] == 'L' or s[i-1] == 'U' or s[i-1] == 'D':
            pass
        else:
            k = False
            break

if k == True:
    print("Yes")
elif k == False:
    print("No")

Submission status: Accepted

Solution code:
import sys
list=input()
def split(a): 
    return [char for char in a]
list=split(list)
even_count=0
odd_count=0
for i in list:
  if even_count%2==0:
      even_count+=1
      continue
  if list[even_count]=="R":
    print("No")
    sys.exit()
  even_count+=1
for i in list:
  if odd_count%2==1:
      odd_count+=1
      continue
  if list[odd_count]=="L":
    print("No")
    sys.exit()
  odd_count+=1
print("Yes")

Submission status: Accepted

Solution code:
s=input()
cont=0
for i in range(0,len(s),2):
  if s[i]=="L":
    print("No")
    cont+=1
    break
for j in range(1,len(s),2):
  if s[j]=="R" and cont==0:
    print("No")
    cont+=1
    break
if cont==0:
    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:
# B - Tap Dance
def main():
    s = input()
    for i in range(0,len(s)):
        if i % 2 == 0:
            if s[i] in ['R','U','D']:
                continue
            else:
                print('No')
                exit()
        else:
            if s[i] in ['L','U','D']:
                continue
            else:
                print('No')
                exit()
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
flg = True
for i in range(1, len(S) + 1):
    if i % 2 and (S[i - 1] in ['R', 'U', 'D']):
        pass
    elif i % 2 == 0 and (S[i - 1] in ['L', 'U', 'D']):
        pass
    else:
        flg = False
    if not flg:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
s_=list(s)
S=list(enumerate(s))
num=len(S)
empty=[]
for x,y in S:
    if (x%2==0 and (y=='R' or y=='U' or y=='D')) or (x%2==1 and (y=='L' or y=='U' or y=='D')):
        empty.append(y)
if empty==s_:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
s=i()
for i in range(math.ceil(len(s)/2)):
  if not (s[2*i]=="R" or s[2*i]=="U" or s[2*i]=="D"):
    print("No")
    sys.exit()
for j in range(len(s)//2):
  if not (s[2*j+1]=="L" or s[2*j+1]=="U" or s[2*j+1]=="D"):
    print("No")
    sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
S=input()

odd=['R','U','D']
even=['L','U','D']
flag=True
for i in range(len(S)):
    if (i+1)%2==0 and not(S[i] in even):
        flag=False
        print('No')
        break 
    elif (i+1)%2==1 and not(S[i] in odd):
        flag=False
        print('No')
        break

if flag:
    print('Yes')

Submission status: Accepted

Solution code:
S = input()
odds = []
evens = []
for i in range(len(S)):
    if i % 2 == 0:
        odds.append(S[i])
    else:
        evens.append(S[i])

if 'L' not in odds and 'R' not in evens:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = 'Yes'
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == 'L':
            ans = 'No'
    else:
        if s[i] == 'R':
            ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
S = input()
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()
for i in range(len(s)):
    if i%2==0:
        if s[i] in 'RUD':
            continue
        else:
            print('No')
            break
    else:
        if s[i] in 'LUD':
            continue
        else:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

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

for i in range(len(s))[0::2]:
    if not s[i] in odd:
        print('No')
        exit(0)

for i in range(len(s))[1::2]:
    if not s[i] in even:
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

Solution code:
import sys
S = list(input())
S.insert(0,"X")

#文字列の奇数番目をチェック
for i in range(1,len(S),2):
  if S[i] == "L":
    print("No")
    sys.exit()
#文字列の偶数番目をチェック
for j in range(2,len(S),2):
  if S[j] == "R":
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
o=[]
e=[]
for i in range(n):
    if (i+1)%2==0:
        e.append(s[i])
    else:
        o.append(s[i])
if o.count('L')==0 and e.count('R')==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S = input()

def check():
  for i in range(len(S)) :
    if i%2!=0 and S[i]=="R" :
      print("No")
      sys.exit(0)
    elif i%2==0 and S[i]=="L" :
      print("No")
      sys.exit(0)
check()
print("Yes")
sys.exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s=input()
cnt=0
for x in s:
  cnt+=1
  if x in ['U','D']:
    continue
  elif cnt %2 and x =='R':
    continue
  elif cnt%2==0 and x=='L':
    continue
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

Solution code:
s=input()
ki=['R','U','D']
gu=['L','U','D']
for i,num in enumerate(s,1):
	if i%2==1:
		if num not in ki:
			print('No')
			exit()
	else:
		if num not in gu:
			print('No')
			exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
L=list(input())
c=len(L)
for i in range(c):
  if i%2==0:
    if L[i]!="R" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
  else:
    if L[i]!="L" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
flag = 1

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

Submission status: Accepted

Solution code:
import sys

S = list(input())
n = len(S)
for i in range(n) :
    if S[2*i] == "L" :
        print("No")
        sys.exit()
    if 2*i == n-1 :
        break
    if S[2*i+1] == "R" :
        print("No")
        sys.exit()
    if 2*i + 1 == n-1 :
        break
print("Yes")

Submission status: Accepted

Solution code:
import sys
S = input()

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

for i, j in enumerate(S):
    if i % 2 == 0:
        if not j in odd:
            print('No')
            sys.exit()
    else:
        if not j in even:
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
S1 = S[0::2]
S2 = S[1::2]

S_count = S1.count('R') + S1.count('U') + S1.count('D')+ S2.count('L') + S2.count('U') + S2.count('D')

if len(S) == S_count:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

s = input()[:-1]

ans = True
for i in range(len(s)):
    if (i+1) % 2 == 1:
        # print(1, s[i])
        if s[i] == 'L':
            ans =False
            break
    if (i + 1) % 2 == 0:
        # print(2, s[i])
        if s[i] =='R':
            ans = False
            break

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

Submission status: Accepted

Solution code:
s=list(input())

l=[]
for i in s[1::2]:
  l.append(i)

new_l=[]
for i in s[::2]:
  new_l.append(i)
ans=0
if 'L' in new_l:
  ans='No'
else:
  ans='Yes'
num=0
if 'R' in l:
  num='No'
else:
  num='Yes'

if ans == 'Yes' and num == 'Yes':
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
LS = list(S)
L = len(S)

LSK = LS[0:L:2]
LSG = LS[1:L:2]

if "L" in LSK or "R" in LSG:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()

odd_list = ['R', 'U', 'D']
even_list = ['L', 'U', 'D']

answer = 'Yes'
for i in range(0, len(S)):
    if (i+1) % 2 == 0:
        if S[i] not in even_list:
            answer = 'No'
            break
    else:
        if S[i] not in odd_list:
            answer = 'No'
            break

print(answer)

Submission status: Accepted

Solution code:
S = input()

odd_li = ['R', 'U', 'D']
even_li = ['L', 'U', 'D']

for i in range(len(S)):
    if i%2==0: #偶数
        if not S[i] in odd_li:
            print('No')
            exit()
    else:
        if not S[i] in even_li:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    for num, i in enumerate(S, 1):
        if num % 2 == 0:
            if i != "L" and i != "U" and i != "D":
                print("No")
                exit(0)

        else:
            if i != "R" and i != "U" and i != "D":
                print("No")
                exit(0)

    print("Yes")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = list(input())
kis = set(S[::2])
gus = set(S[1::2])
print("Yes" if kis.issubset({"R", "U", "D"}) & gus.issubset({"L", "U", "D"}) else "No")

Submission status: Accepted

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

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:
s=list(input())
for i in range(len(s)):
  if i%2!=0:
    if s[i]=='L' or s[i]=='U' or s[i]=='D':
      s[i]='i'
      
  else:
    if s[i]=='R' or s[i]=='U' or s[i]=='D':
      s[i]='i'
      
#print(s)
if s==['i']*len(s):
  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]!='R' and S[i]!='U' and S[i]!='D':
      flag=True
  else:
    if S[i]!='L' and S[i]!='U' and S[i]!='D':
      flag=True
if flag==True:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()

w1 = [ "R", "U", "D"]
w2 = [ "L", "U", "D"]

for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in w1 :
      print("No")
      exit()
  else :
    if not s[i] in w2 :
      print("No")
      exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

gomilist=["L","R"]*(n//2)
if n%2 == 1:
    gomilist.append("L")

for i in range(len(s)):
    if s[i] == gomilist[i]:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
import sys
s=input()
a=["R","U","D"]
b=["L","U","D"]
for i in range(len(s)):
    if i%2==0:
        if s[i] not in a:
            print("No")
            sys.exit()
    else:
        if s[i] not in b:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ok = True
for i in range(len(S)):
    if (i + 1) % 2:
        if S[i] not in ['R', 'U', 'D']:
            ok = False
    else:
        if S[i] not in ['L', 'U', 'D']:
            ok = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

ans = "Yes"
if flg: ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    count = 1
    flg = True
    for s in S:
        if count % 2 == 0 and s == 'R':
            print('No')
            exit()
        elif count % 2 == 1 and s == 'L':
            print('No')
            exit()
        count += 1
    print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(s):
    odd_steps = set(s[::2])
    even_steps = set(s[1::2])

    cond1 = odd_steps.issubset({'U', 'D', 'R'})
    cond2 = even_steps.issubset({'U', 'D', 'L'})

    if cond1 and cond2:
        return 'Yes'

    return 'No'

s = input()

print(actual(s))

Submission status: Accepted

Solution code:
s = input()
result = True

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


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

Submission status: Accepted

Solution code:
S = input()

SR = S[0 : : 2]
SL = S[1 : : 2]

print('No' if 'L' in SR or 'R' in SL else 'Yes')

Submission status: Accepted

Solution code:
S = input()
lis = list()
for i in range(len(S)):
    if i % 2==0:
        if S[i] == "U" or S[i] == "R"or S[i] == "D":
            lis.append(True)
        else:
            lis.append(False)
    else:
        if S[i] == "L" or S[i] == "U"or S[i] == "D":
            lis.append(True)
        else:
            lis.append(False)


if all(lis):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

for i, j in enumerate(s):
    if (i + 1) % 2 == 1:
        if j == 'L':
            print('No')
            exit()
    else:
        if j == 'R':
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()
a = [s[i] for i in range(len(s)) if (i + 1) % 2 == 1]
b = [s[i] for i in range(len(s)) if (i + 1) % 2 == 0]
a = list(set(a))
b = list(set(b))
a.sort()
ans = ''
for e in a:
  if ans == '':
    if e == 'R' or e == 'U' or e == 'D':
      next
    else:
      ans = 'No'
if ans == '':
  for e in b:
    if ans == '':
      if e == 'L' or e == 'U' or e == 'D':
        next
      else:
        ans = 'No'
if ans == '':
  ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    S = list(input())
    N = len(S)
    rud = ['R', 'U', 'D']
    lud = ['L', 'U', 'D']

    flag = True
    for i in range(N):
        if (i + 1) % 2 == 0:
            if not (S[i] in lud):
                flag = False
        else:
            if not (S[i] in rud):
                flag = False

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


if __name__ == '__main__':
    solve()