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

s = sys.stdin.readline().strip()

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

print("Yes" if solve(s) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

S_even = []
S_odd = []

for i in range(0,len(S)):
    if i%2 == 0:
        S_even.append(S[i])
    else:
        S_odd.append(S[i])

if 'L' in S_even:
    print('No')
elif 'R' in S_odd:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
odd = []
even = []
for i in range(len(s)):
    if i % 2 == 0:
        odd.append(s[i])
    else:
        even.append(s[i])
if 'L' in odd:
    print("No")
    exit()
elif 'R' in even:
    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':
    s = False
    break
  elif i % 2 == 0 and s[i] == 'L':
    s = False
    break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

odd  = set(c for i, c in enumerate(S) if i % 2 == 0)
even = set(c for i, c in enumerate(S) if i % 2 == 1)

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

Submission status: Accepted

Solution code:
import sys

S = input()

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

import math
import sys


DEBUG = False


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def main():
    S = input()

    odd = set(['R', 'U', 'D'])
    even = set(['L', 'U', 'D'])

    ans = 'Yes'
    for i, c in enumerate(S):
        if (i + 1) % 2 == 0:
            if c == 'R':
                ans = 'No'
        else:
            if c == 'L':
                ans = 'No'

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())

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

for i, s in enumerate(S):
    if i % 2 == 0 and s not in odd:
        print("No")
        break
    if i % 2 == 1 and s not in even:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s=list(input())

n=len(s)
judge=True
for i in range(n):
    if not s[i]=="D" or s[i]=="U":

        if not i%2==1 and s[i]=="L":
            judge=False
            break
        else:
            if not i%2==0 and s[i]=="R":
                judge=False
                break
if judge==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def solve():
    music_score = input()
    for note in music_score[0::2]:  # 奇数文字目
        if note == 'L':
            print('No')
            return
    for note in music_score[1::2]:   # 偶数文字目
        if note == 'R':
            print('No')
            return
    print('Yes')

solve()

Submission status: Accepted

Solution code:
def get_answer(input_list):
    d = input_list[0]
    f1 = True
    f2 = True
    for i in range(len(d)):
        s = d[i]
        if (i + 1) % 2 == 1:
            if s not in ["R","U","D"]:
                f1 = False
        else:
            if s not in ["L","U","D"]:
                f2 = False

    if f1 and f2:
        return "Yes"
    return "No"



if __name__ == "__main__":
    input_list = []
    while True:
        try:
            input1 = input()
            if not input1:
                break
            if len(input1) == 0:
                break
            input_list.append(input1)
        except EOFError:
            break
    print(get_answer(input_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(str(input()))
judge=True
for i, name in enumerate(S):
    if S[i]=="R" and i%2==0:
        continue
    elif S[i]=="L" and i%2!=0:
        continue
    elif S[i]=="U"or S[i]=="D":
        continue
    else:
        print("No")
        judge=False
        break
if judge==True:
    print("Yes")

Submission status: Accepted

Solution code:
s = tuple(str(input()))

c = 0
f = True

for i in s:
  c += 1
  if c % 2 != 0:
    if i == 'L':
      f = False
      break
  else:
    if i == 'R':
      f = False
      break

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

Submission status: Accepted

Solution code:
s = input()

if all(w in ('R', 'U', 'D') for w in s[::2]) and \
        all(w in ('L', 'U', 'D') for w in s[1::2]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
l=len(s)
ans=0
for i in range(0,l,2): #[0,2,...]
  if not (s[i]=='R' or s[i]=='U' or s[i]=='D'):
    ans=1
for i in range(1,l,2): #[1,3,...]
  if not (s[i]=='L' or s[i]=='U' or s[i]=='D'):
    ans=1
if ans==0:
  print('Yes')
else:
  print('No')

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

print('Yes')

Submission status: Accepted

Solution code:
S = input()

counter = 1
yorn = 1
for foot in S:
    if foot == 'R':
        if counter % 2 == 0:
            yorn=0
            break
    elif foot == 'L':
        if counter % 2 == 1:
            yorn = 0
            break
    counter+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

s = input()
p = re.compile(r'^([^L][^R])*[^L]?$')
if p.match(s):
    print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
S = input()
for idx, char in enumerate(S):
    if idx % 2 == 0 and char == "L":
        print("No")
        break
    elif idx % 2 == 1 and char == "R":
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = "Yes"

for i in range(N):
    if (i+1) % 2:
        if S[i] in odd:
            pass
        else:
            ans = "No"
            break
    else:
        if S[i] in even:
            pass
        else:
            ans = "No"
            break

print(ans)

Submission status: Accepted

Solution code:

sarr = input()
kisuu = ['R', 'U', 'D']
gusuu = ['L', 'U', 'D']

is_fumiyasui = True
for i, s in enumerate(sarr):
  if (i+1) % 2 == 0:
    if s not in gusuu:
      is_fumiyasui = False
      break
  else:
    if s not in kisuu:
      is_fumiyasui = False
      break


print('Yes' if is_fumiyasui else '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:
def check(arr, c):
  for each in arr:
    if each == c or each == "U" or each == "D":
      pass
    else:
      return False
  return True

steps = input()
odds = steps[::2]
evens = steps[1::2]
if check(odds, "R") and check(evens, "L"):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()

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

Submission status: Accepted

Solution code:
import numpy as np

S = input()
 
S = np.array( [S[i] for i in range(len(S))] )
 
if (S[0::2]=='L').any():
  print('No')
elif (S[1::2]=='R').any():
  print('No')
else:
  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()
print('Yes' if 'L' not in S[::2] and 'R' not in S[1::2] else 'No')

Submission status: Accepted

Solution code:
s = input()
i = 0
ans = 'Yes'

for i in range(len(s)):
    if i % 2 == 1:
        if s[i] == 'R':
            ans = 'No'
    else:
        if s[i] == 'L':
            ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
n = input()
en=len(n)//2
evn=[]
odn=[]
for i in range(len(n)):
    if i%2==0 and n[i] == "L":
        print("No")
        exit()
    if i%2>0 and n[i] == "R":
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
out = "Yes"
for i, char in enumerate(S):
    if (i + 1) % 2 == 0 and char != "L" and char != "U" and char != "D":
        out = "No"
        break
    elif (i + 1) % 2 == 1 and char != "R" and char != "U" and char != "D":
        out = "No"
        break
print(out)

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:
table=[{'L':False, 'R':True, 'U':True, 'D':True,},
       {'L':True, 'R':False, 'U':True, 'D':True,}]
S=input()
if all([table[i%2][c] for i, c in enumerate(S)]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import re

S = input()
p = re.compile(r'^([^L][^R])*[^L]?$')
if p.match(S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

print("Yes")

Submission status: Accepted

Solution code:
def check(*a_list):
    count = 0
    for i in a_list:
        if count % 2 == 0:  # 奇数
            if i == "L":
                return "No"
        else:  # 偶数
            if i == "R":
                return "No"
        count += 1
    return "Yes"

S = input()
print(check(*S))

Submission status: Accepted

Solution code:
S=input()
Flag=True
for i, c in enumerate(S):
    if i%2==0 and c=='L': # odd
        Flag=False
        continue
    if i%2==1 and c=='R': # even
        Flag=False
        continue
if Flag:
    print('Yes')
else:
    print('No')

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 == 1) and (s[i] == "L"):
    print("No")
    break
  
  if i == len(s)-1:
    print("Yes")
    break

Submission status: Accepted

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

for i in range(N):
    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:
a=input().strip()
t=1
for i in range(len(a)):
  if i%2==0 and a[i] not in ['R','U','D']:
    t=0
    break
  elif i%2!=0 and a[i] not in ['L','U','D']:
    t=0
    break
if t==1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# L = [int(v) * -1 for v in input().split()]

S = input().strip()

for i in range(len(S)):
    if i % 2 == 0:
        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()
a =[]
b =[]

for i in range(len(s)):
  if i%2==0:
    a.append(s[i])
  else:
    b.append(s[i])
if 'R' in b or 'L' in a:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

for i, c in enumerate(s):
    if i & 1 == 0 and c not in odd:
        print('No')
        exit()
    if i & 1 == 1 and c not in even:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()

flg = True
for index, char in enumerate(s):
    if index % 2 == 0:
        if char == 'L':
            flg = False
            break
    else:
        if char == 'R':
            flg = False
            break
    
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

flag = True
for i in range(len(S)):
    if i % 2 == 1:  # 偶数
        if S[i] == "R":
            flag = False
            break
    if i % 2 == 0:  # 奇数
        if S[i] == "L":
            flag = False
            break

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

Submission status: Accepted

Solution code:
str = input()
num = len(str)
ans = True
for i in range(num):
    if (i+1) % 2 == 0:
        if str[i] == "R":
            ans = False
    else:
        if str[i] == "L":
            ans = False

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

Submission status: Accepted

Solution code:

#S = "RDULULDURURLRDULRLR"
S = input()
ans = "Yes"
i=1
for c in S:
    if((i % 2 == 0 and c == "R") or (i % 2 == 1 and c == "L")):
        ans = "No"
        break
    i+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

sn = lambda : stdin.readline().rstrip()
an = lambda : map(int, stdin.readline().split())
ni = lambda : int(sn())

s = sn()

odd = s[::2]
even = s[1::2]
ans = "Yes"
for o in odd:
  if o not in ("R", "U", "D"):
    ans = "No"
for e in even:
  if e not in ("L", "U", "D"):
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()
count = 1
result = "Yes"
for c in S:
  if count % 2 != 0:
    if c == "L":
      result = "No"
  else:
    if c == "R":
      result = "No"
  count += 1

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())

f=0

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

Submission status: Accepted

Solution code:
s = input()
odd = True
flag = True

for c in s:
  if (odd and c == 'L') or (not odd and c == 'R'):
    flag = False
    break
  odd = not odd
  
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n = list(input())
flag =0
for i in range(len(n)):
  if i%2==0:#奇数
    if n[i]=="L":
      flag=1
  elif i%2==1:
    if n[i]=="R":
      flag=1
if flag==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

gu = ""
ki = ""
for n, i in enumerate(s):
    if n % 2 == 0:
        gu = gu + i
    else:
        ki = ki + i

#gu
for i in gu:
    if i not in ["R", "U", "D"]:
        print("No")
        exit()
#ki
for i in ki:
    if i not in ["L", "U", "D"]:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:


def main():
    s = input()
    print('Yes' if is_easy_to_step(s) else 'No')


def is_easy_to_step(strs):
    for i, s in enumerate(strs):
        if i % 2 != 0 and (s == 'L' or s == 'U' or s == 'D'):
            continue
        elif i % 2 == 0 and (s == 'R' or s == 'U' or s == 'D'):
            continue
        else:
            return False

    return True


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ls = [['R', 'U', 'D'], ['L', 'U', 'D']]
f = True
for i in range(len(S)):
    if S[i] in ls[i%2]:
        pass
    else:
        f = False
        break
print('Yes' if f else 'No')

Submission status: Accepted

Solution code:
S = input()
Ls = ['L', 'U', 'D'] #偶数
Rs = ['R', 'U', 'D'] #奇数
f = True
for i in range(len(S)):
    if (i%2 == 0 and S[i] in Rs) or (i%2 == 1 and S[i] in Ls):
        pass
    else:
        f = False
        break
print('Yes' if f else 'No')

Submission status: Accepted

Solution code:
s=list(input())

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

Submission status: Accepted

Solution code:
s = input()

length = len(s)

if len(s) ==1:
    flag1, flag2= True, True
else:
    flag1, flag2= False, False

odds = "RUD"
evens ="LUD"

for x in range (0,len(s),2):
    if s[x] in odds:
        flag1 = True        
    else:
        flag1= False
        break
        

for x in range (1,len(s),2):
    if s[x] in evens:
        flag2 = True
    else:
        flag2 = False
        break

if flag1 ==True and flag2 == True:
    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':
            print('No')
            exit()
    else:
        if S[i] == 'L':
            print('No')
            exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dance = list(input())

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

Submission status: Accepted

Solution code:
s = input()
odd = s[::2].replace("R","").replace("U","").replace("D","")
even = s[1::2].replace("L","").replace("U","").replace("D","")
if len(odd)==0 and len(even)==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S= list(input())
a=[]
for i in range(0,len(S)):
  if i%2==0:
    if S[i]=="R" or S[i] == "U" or S[i]=="D":
      a.append(1)
  elif i%2!=0:
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
      a.append(1)
if len(S)==sum(a):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys

S=sys.stdin.readline().rstrip()
if ("L" in S[0::2] or "R" in S[1::2]):
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(s):
    for i, c in enumerate(s):
        if i % 2 == 1:
            if not c in ["L", "U", "D"]:
                return "No"
        else:
            if not c in ["R", "U", "D"]:
                return "No"
    return "Yes"

s = input()
print(solve(s))

Submission status: Accepted

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

Submission status: Accepted

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

print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
s = list(input())

for index,value in enumerate(s):
  if index%2==0:
    if value!="R" and value!="U" and value!="D":
      print("No")
      exit()
  else:
    if value!="L" and value!="U" and value!="D":
      print("No")
      exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
justified=True
S=list(input())
check1=["R","U","D"]
check2=["L","U","D"]
for j in range(len(S)):
    if( j)%2==0:
        if  S[j] in check1:
            continue
        else:
            justified=False
            break
        
    if (j)%2==1:
        if S[j] in check2:
            continue
        else:
            justified=False
            break
if justified:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
arg = input()

isOk = True

for i in range(len(arg)):
    
    if i % 2 == 0:

        if arg[i] == 'L':
            isOk = False
    else:
        if arg[i] == 'R':
            isOk = False

msg = ''

if (isOk):
    msg = 'Yes'
else:
    msg = 'No'

print(msg)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 0

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

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

Submission status: Accepted

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

S = list(input())
Odd = set([S[i] for i in range(len(S)) if i % 2 == 0])
Even = set([S[i] for i in range(len(S)) if i % 2 != 0])
if 'L' in Odd or 'R' in Even:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(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()
li = list(s)
a=[]
b=[]
for i in range(len(li)):
  if i%2 == 0:
    a.append(li[i])
  else:
    b.append(li[i])

if 'L' in a or 'R' in b:
  print('No')

else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
	try:
		D = list(input())
		isPlayable = True
		for i in range(0, len(D), 2):
			if D[i] == 'L':
				isPlayable = False
				break
		if isPlayable:
			for i in range(1, len(D), 2):
				if D[i] == 'R':
					isPlayable = False
					break
		if isPlayable:
			print("Yes")
		else:
			print("No")
	except:
		break

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in "RUD":
            pass
        else:
            print("No")
            exit()
    else:
        if s[i] in "LUD":
            pass
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

for i, j in enumerate(s):
    if i % 2 == 0:
        if j not in even:
            print('No')
            break
    else:
        if j not in odd:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
def check(S, even, odd):
  for i,c in enumerate(S):
    if i % 2 == 0:
      if not c in even:
        return "No"
    else:
      if not c in odd:
        return "No"
  return "Yes"

S = input()
even = ["R", "U", "D"] 
odd = ["L", "U", "D"]
print(check(S, even, odd))

Submission status: Accepted

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