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:
import sys
from pprint import pprint

def solve(s):
    odd = ['R', 'U', 'D']
    even = ['L', 'U', 'D']
    for i, s_i in enumerate(s):
        if i % 2 == 0:
            if s_i not in odd:
                print("No")
                return
        if i % 2 == 1:
            if s_i not in even:
                print("No")
                return

    print("Yes")

if __name__ == '__main__':
  s = sys.stdin.readline().strip()
  solve(s)

Submission status: Accepted

Solution code:
S = input()

i = 1
flg = 0

for s in S:
  if i % 2 == 1:
    if s != 'R' and s != 'U' and s != 'D':
      flg = 1
      print('No')
      break
      
  if i % 2 == 0:
    if s != 'L' and s != 'U' and s != 'D':
      flg = 1
      print('No')
      break  
      
  i = i + 1
      
if flg == 0:
  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()
    i += 1
print("Yes")

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int,ins()))
def lin(): return list(input())
def iin(): return map(int,ins())

s = input()
for i,j in enumerate(s):
    if j == 'U' or j == 'D':
        continue
    elif (j == 'R' and i%2==1) or (j == 'L' and i%2==0):
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=list(input())
flag=0
for i in range(len(S)):
    if i%2==0:
        if S[i]=="L":
            flag=1
            break
    elif i%2==1:
        if S[i]=="R":
            flag=1
            break

if flag==1:
    print("No")
elif flag==0:
    print("Yes")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[13]:


S = input()


# In[14]:


odd_list = list(S[::2])
even_list = list(S[1::2])


# In[15]:


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


# In[ ]:

Submission status: Accepted

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

if X=="No"   :
    print("No")

else:
    print("Yes")

Submission status: Accepted

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

    ans = 'Yes'

    for odd_s in s[::2]:
        if odd_s not in ['R', 'U', 'D']:
            ans = 'No'
            return(ans)

    for even_s in s[1:][::2]:
        if even_s not in ['L', 'U', 'D']:
            ans = 'No'
            return(ans)

    return(ans)

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

Submission status: Accepted

Solution code:
S = input()

for i, v in enumerate(S):
    if i % 2 == 0 and v in ["R", "U", "D"] or i % 2 == 1 and v in ["L", "U", "D"]:
        pass
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
step = input()
flag = True
for i, n in enumerate(step):
  if i%2==0:
    if n is "L":
      print("No")
      flag = False
      break      
  if i%2 == 1:
    if n is "R":
      print("No")
      flag = False
      break
if flag:
  print("Yes")

Submission status: Accepted

Solution code:
s = input()
c = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != "R" and s[i] != "U" and s[i] != "D":
            c += 1
    else:
        if s[i] != "L" and s[i] != "U" and s[i] != "D":
            c += 1

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

Submission status: Accepted

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

Submission status: Accepted

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



flag = 1
for i in range(L):
  if i%2 == 0:
    if s[i] == "L":
      flag = 0
      break
  if i%2 == 1:
    if s[i] == "R":
      flag = 0
      break

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

Submission status: Accepted

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

count=0
for i, s in enumerate(S):
    if i%2==0:
        if s!="U" and s!="D" and s!="R":
             count=1
             break

    else:
        if s!="U" and s!="D" and s!="L":
             count=1
             break

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

Submission status: Accepted

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

odd_cond = ("R", "U", "D")
even_cond = ("L", "U", "D")


for i, s in enumerate(S):
    if i % 2 == 0:
        cond = s in odd_cond
    else:
        cond = s in even_cond

    if not cond:
        print("No")
        break

if cond:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
odd = {'R','U','D'}
even = {'L','U','D'}

cnt = 0

for i in range(n):
  if i % 2 == 0 and s[i] in odd:
    cnt += 1
  elif i % 2 == 1 and s[i] in even:
    cnt += 1
    
print('Yes' if cnt == n else 'No')

Submission status: Accepted

Solution code:
s = input()
s_ki = s[0::2]
s_gu = s[1::2]
count = 0
for i in s_ki:
    if i == 'L':
        count += 1
for _ in s_gu:
    if _ == 'R':
        count += 1
if count ==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

Solution code:
def resolve():
    S = input()

    ans = "Yes"
    n = len(S)
    for i in range(n):
        if i % 2 != 0: 
            if S[i] == "R":
                ans = "No"
        if i % 2 == 0: 
            if S[i] == "L":
                ans = "No"
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

f = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] == 'R':
            f = False
    else:
        if s[i] == "L":
            f = False
if f == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
odds = ['R','U','D']
evens = ['L','U','D']
steps = list(input())
if len(set(steps[0::2])-set(odds)) == 0 and len(set(steps[1::2])-set(evens)) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

# input
S = input()

# solve
ans = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 'L':
            ans = False
            break
    else:
        if S[i] == 'R':
            ans = False
            break

# output
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()
Se = list(filter(lambda s:s=='L',S[::2]))
So = list(filter(lambda s:s=='R',S[1::2]))
re = 'Yes' if len(Se)+len(So) == 0 else 'No'
print(re)

Submission status: Accepted

Solution code:
s = [i for i in input()]

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

Submission status: Accepted

Solution code:
S = list(input())
is_ok = False
for n, s in enumerate(S):
    if n % 2 == 0:
        if s == "R" or s == "U" or s == "D":
            is_ok = True
        else:
            is_ok = False
            break
    if n % 2 == 1:
        if s == "L" or s == "U" or s == "D":
            is_ok = True
        else:
            is_ok = False
            break
if is_ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

count = 0
for s in range(len(S)):
    if (s+1) % 2 == 1 and (S[s] == 'R' or S[s] == 'U' or S[s] == 'D'):
        count += 1

    elif (s+1) % 2 == 0 and (S[s] == 'L' or S[s] == 'U' or S[s] == 'D'):
        count += 1

if count == len(S):
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = 'Yes'
even = ['L', 'U', 'D']
odd = ['R', 'U', 'D']
for i in range(len(S)):
    if i%2 ==1 and S[i] not in even:#even
        ans = 'No'
        break
    if i%2 ==0 and S[i] not in odd: #odd
        ans = 'No'
        break

print (ans)

Submission status: Accepted

Solution code:
import sys

seq = sys.stdin.readline().strip()
odd_str = 'RUD'
even_str = 'LUD'
result = 'Yes'

for i in range(len(seq)):
    c = seq[i]
    if (i + 1) % 2 == 0:
        if not c in even_str:
            result = 'No'
    else:
        if not c in odd_str:
            result = 'No'

print(result)

Submission status: Accepted

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

odd = {'R', 'U', 'D'}
even = {'L', 'U', 'D'}

for i in range(0, N, 2):
    if S[i] in odd:
        continue
    else:
        print('No')
        exit()

for i in range(1, N, 2):
    if S[i] in even:
        continue
    else:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
steps = list(input())
def test(ss):
    odd = set("RUD")
    even = set("LUD")
    for i, s in enumerate(ss):
        num = i+1
        if num%2:
            if s not in odd:
                return "No"
        elif s not in even:
            return "No"
    return "Yes"
print(test(steps))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
s = input()
odd = "R"
even = "L"
ans = 0

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

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

Submission status: Accepted

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

    for i in range(len(s)):
        if (i+1)&1 == 1:
            if (s[i] == "R") + (s[i] == "U") + (s[i] == "D"):
                pass
            else:
                print("No")
                return
        elif (i+1)&1 == 0:
            if (s[i] == "L") + (s[i] == "U") + (s[i] == "D"):
                pass
            else:
                print("No")
                return

    print("Yes")

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[3]:


#import sys
S = input()


# In[4]:


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


# In[ ]:

Submission status: Accepted

Solution code:
S = list(input())
bool = "true"

for i in range(0, len(S), 2):
    if S[i] == "L":
        bool = "false"

for i in range(1, len(S), 2):
    if S[i] == "R":
        bool = "false"

if bool == "true":
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
odd ={"R","U","D"}
even = {"L","U","D"}
l = len(S)
S_odd = {S[i] for i in range(l) if i%2==0}
S_even = {S[i] for i in range(l) if i%2==1}

if S_odd <= odd and S_even <= even:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str = input()

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

Submission status: Accepted

Solution code:
import sys
S = input()
for i,item in enumerate(S):
    if i%2==0:
        if item not in ['R', 'U', 'D']:
            print('No')
            sys.exit()
    else:
        if item not in ['L', 'U', 'D']:
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()
count = 0
kisu = ["R", "U", "D"]
dusu = ["L", "U", "D"]
H = 0

for c in S:
    count += 1
    if count % 2 == 1:
        if c in kisu:
            pass
        else:
            H = 1
    else:
        if c in dusu:
            pass
        else:
            H = 1

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

Submission status: Accepted

Solution code:
def A():
    w = ['Sunny', 'Cloudy', 'Rainy']
    today = input()
    index = w.index(today)
    if index == 2:
        index = -1
    print(w[index+1])

def B():
    odd = 'RUD'
    even = 'LUD'

    s = input()
    for i in range(len(s)):
        if (i+1)%2 == 0:
            if s[i] not in even:
                print('No')
                return
        else:
            if s[i] not in odd:
                print('No')
                return
        
    print('Yes')

B()

Submission status: Accepted

Solution code:
s=list(input())

n=1
yes=True
for i in s:
	if n%2!=0:
		if (i=="R" or i=="U" or i=="D"):
			pass

		else:
			yes=False

	else:
		if  (i=="L" or i=="U" or i=="D"):

			pass
		else:
			yes=False
	n+=1

if yes:
	print("Yes")

else:
	print("No")

Submission status: Accepted

Solution code:
S = input()
result = 'Yes'

max = len(S)
for i in range(max):
    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= list(input())
for i in range(len(S)):
    if (S[i]=='L' and i%2==0) or (S[i]=='R' and i%2==1):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

kisuu_list = ['R', 'U', 'D']
gusuu_list = ['L', 'U', 'D']

flag = "Yes"
for i in range(len(S)):
  if i%2 == 0 and S[i] not in kisuu_list:
    flag = "No"
    break
  if i%2 == 1 and S[i] not in gusuu_list:
    flag = "No"
    break
print(flag)

Submission status: Accepted

Solution code:
s = input()

f = True
for i in range(0, len(s), 2):
  if not (s[i] == 'R' or s[i] == 'U' or s[i] == 'D'):
    f = False
for i in range(1, len(s), 2):
  if not (s[i] == 'L' or s[i] == 'U' or s[i] == 'D'):
    f = False
print('Yes' if f else 'No')

Submission status: Accepted

Solution code:
odd= ('R', 'U', 'D')
even = ('L','U','D')

S=input()
S_num=len(S)

flg = 0
for i in range(S_num):
  if (i%2 == 0 and S[i] == 'L') or ( i%2 == 1 and S[i] == 'R'):
    flg=1
    break
if flg==1:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
N = input()

answer = 'Yes'
for i in range(1, len(N)+1):

    # even
    if i % 2 == 0:
        if N[i-1] == 'R':
            answer = 'No'
            break
    else:
        if N[i-1] == 'L':
            answer = 'No'
            break

print(answer)

Submission status: Accepted

Solution code:
s = input()
isOdd = True
for i in range(len(s)):
    if isOdd == False and s[i] == 'R':
        print('No')
        exit()
    if isOdd == True and s[i] == 'L':
        print('No')
        exit()
    isOdd = not isOdd

print('Yes')

Submission status: Accepted

Solution code:
S = list(input())
od = ['R', 'U', 'D'] 
ev = ['L', 'U', 'D'] 

ans = 'Yes'
for i,s in enumerate(S):
    if i%2 == 0:
        if s in od:
            pass
        else:
            ans = 'No'
            break
    else:
        if s in ev:
            pass
        else:
            ans = 'No'
            break

print(ans)

Submission status: Accepted

Solution code:
STR = [s for s in input()] 
k = 0
for i in range((len(STR)+1)//2  ):
    if STR[i*2] == "L":
        k = 1
    else:
        pass 
for i in range((len(STR))//2  ):
    if STR[i*2+1] == "R":
        k = 1
    else:
        pass 

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

Submission status: Accepted

Solution code:
n = (input())

f = 0

for i in range(len(n)):
  if n[i] != 'U' and  n[i] != 'D':
    if i % 2 == 0:
      if n[i] != 'R':
        f = 1
    else:
      if n[i] != 'L':
        f = 1

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

Submission status: Accepted

Solution code:
tap = input()

tap_odd = tap[::2]
tap_even = tap[1::2]

if 'L' in tap_odd or 'R' in tap_even:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from copy import deepcopy


def main():
    s = input()

    s_list = list(s)
    one_result = True
    two_result = True
    for i in range(len(s_list)):
        if i % 2 == 0:
            if s_list[i] == 'L':
                one_result = False
        else:
            if s_list[i] == 'R':
                two_result = False

    if one_result and two_result:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 0
for si,ss in enumerate(s):
    if si%2 == 1 and ss not in ['L','U','D']:
        count += 1
    if si%2 == 0 and ss not in ['R','U','D']:
        count += 1
if count == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

    else:
        if not S[i] in B:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

Solution code:
S=input()
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Skx=Sk.count('L')
Sgx=Sg.count('R')
if Skx+Sgx==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
oddsteps = "RUD"
evensteps = "LUD"
s = input()
n = len(s)
odd = [1 if s[i] in oddsteps else 0 for i in range(0, n, 2)]
even = [1 if s[i] in evensteps else 0 for i in range(1, n, 2)]
if sum(odd) + sum(even) == n:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def calc(s):
    r = "Yes"
    for i in range(len(s)):
        c = s[i]
        if (i+1) % 2 == 0:
            if c not in ["L", "U", "D"]:
                r = "No"
                break
        else:
            if c not in ["R", "U", "D"]:
                r = "No"
                break
    return r


s = input()

r = calc(s)
print(r)

Submission status: Accepted

Solution code:
S = input()

ans = "Yes"

# Odd
Odd = S[::2]
for o in Odd:
  if o == "L":
    ans = "No"

# Even
Even = S[1::2]
for e in Even:
  if e == "R":
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:

s = input()

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
if len(s)==1:
  if s in {"R","U","D"}:
    print("Yes")
  else:
    print("No")
  exit()
o=set(s[::2])
e=set(s[1::2])
for n in o:
  if n not in {"R","U","D"}:
    print("No")
    exit()
for f in e:
  if f not in {"L","U","D"}:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:



def main():


    S = input()

    if 'L' in S[0::2] :
        print('No')
        exit()
    if 'R' in S[1::2]:
        print('No')
        exit()
    print('Yes')







if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

S=input()

even=[]
odd=[]

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

odd_flag=True
for o in odd:
    if(o=="R" or o=="U" or o=="D"):
        pass
    else:
        odd_flag=False

even_flag=True
for e in even:
    if(e=="L" or e=="U" or e=="D"):
        pass
    else:
        even_flag=False


if(odd_flag and even_flag):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
odd = ["R","U","D"]
even = ["L","U","D"]
flag1=True
flag2=True
for i in range(1,len(s)+1):
    if (i%2==1) and not(s[i-1] in odd):
        flag1 =False
    if (i%2==0) and not(s[i-1] in even):
        flag2 = False

if flag1 and flag2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


s = S()
flag = False
for i in s[::2]:
    if i not in ['R', 'U', 'D']:
        flag = True
for j in s[1::2]:
    if j not in ['L', 'U', 'D']:
        flag = True
if flag:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

i = 1
badFlag = 0
for c in s:
    if i % 2 == 0:
        if not(c == 'L' or c == 'U' or c == 'D'):
            badFlag = 1
    else:
        if not(c == 'R' or c == 'U' or c == 'D'):
            badFlag = 1
    if badFlag == 1:
        break
    i += 1

if badFlag == 1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = str(input())
i = 1

for a in S:
    if i % 2 ==0:
        if a == "R":
            print("No")
            exit()
    else:
        if a == "L":
            print("No")
            exit()
    i += 1

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = list(input())
lst_ki = []
lst_gu = []

for i in range(len(lst)):
    if i%2==1:
        lst_gu+=lst[i]
    else:
        lst_ki+=lst[i]

ki = ["R","U","D"]
gu = ["L","U","D"]

for i in range(len(lst_gu)):
    if lst_gu[i] not in gu:
        print("No")
        exit()
for i in range(len(lst_ki)):
    if lst_ki[i] not in ki:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
s = list(input())
easy = [
  {'R','U','D'},
  {'L','U','D'},
]
for i, ch in enumerate(s):
  if(ch in easy[i % 2]):
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

if "L" in s[::2]:
    ans = "No"
if "R" in s[1::2]:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:
S = input()

def judge(S):
    for i in range(len(S)):
        if i % 2 == 0 and S[i] == 'L':
            return 'No'
        elif i % 2 != 0 and S[i] == 'R':
            return 'No'
    return('Yes')

print(judge(S))

Submission status: Accepted

Solution code:
O = "RUD"
E = "LUD"

S = input()
f = 0
for i in range(len(S)):
  if i % 2:
    if S[i] in E:
      f += 1
  else:
    if S[i] in O:
      f += 1

if len(S) == f:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
e = []
o = []
for i in range(len(S)):
  if i%2==0:
    e.append(S[i])
  else:
    o.append(S[i])
e = list(set(e))
o = list(set(o))
if 'R' in o or 'L' in e:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = raw_input()

ok = True

for i, c in enumerate(S):
    if i%2 == 1 and c == 'R': ok = False
    if i%2 == 0 and c == 'L': ok = False
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# ABC141b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

s = input()[:-1]

even = set()
odd = set()

for i in range(0, len(s), 2):
    even.add(s[i])
for i in range(1, len(s), 2):
    odd.add(s[i])
#print(odd, even)
print('Yes' if (len(odd - set(list('LUD'))) == 0) and (
    len(even - set(list('RUD'))) == 0) else 'No')

Submission status: Accepted

Solution code:
l=list(input())
n=len(l)
b=True
for i in range(1,1+n):
  if i%2==0:
    if l[i-1]=="R":
      b=False
  else:
    if l[i-1]=="L":
      b=False
if b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=input()
ss = list(str(s))
import sys

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

Submission status: Accepted

Solution code:
s = list(input())

fl = True
fg = True
for i in range(len(s)):
    if (i+1)%2 == 1:
        if s[i] != "R" and s[i] != "U" and s[i] != "D":
            fl = False

    else:
        if s[i] != "L" and s[i] != "U" and s[i] != "D":
            fg = False

if fl and fg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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