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()
 
is_good = "Yes"
for i,string in enumerate(s):
  if i % 2 == 0 and string in ["R", "U", "D"]:
    continue
  elif i % 2 == 1 and string in ["L", "U", "D"]:
    continue
  else:
    is_good = "No"
    break
print(is_good)

Submission status: Accepted

Solution code:
s = str(input())

ki = s[::2]
gu = s[1::2]

if ki.find("L")==-1 and gu.find("R")==-1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# def
def detect_q2(step_list):
    for k,s in enumerate(step_list):

        if k % 2 == 0:
            if s == 'L':
                return False
        else:
            if s == 'R':
                return False

    return True

# input
step = str(input())
step_list = list(step)

# main
if detect_q2(step_list):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    steps = str(input())

    index = 0

    correct = True

    for step in steps:
        # 偶数
        if index % 2 == 0:
            if step == 'L':
                correct = False
        # 奇数
        if index % 2 == 1:
            if step == 'R':
                correct = False
        index += 1

    if correct is True:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
s = input()
safe = ['RUD', 'LUD']
easy = all(c in safe[i % 2] for i, c in enumerate(s))
print('Yes' if easy else 'No')

Submission status: Accepted

Solution code:
import re

s = input()
even_list = []
odd_list = []

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

for i in range(len(even_list)):
    if not re.match(r'[L,U,D]',even_list[i]):
        print("No")
        exit()

for i in range(len(odd_list)):
    if not re.match(r'[R,U,D]', odd_list[i]):
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
#        for line in sys.stdin:
#            lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s, )


def solve(s, ):

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

        if i % 2 == 1:
            if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
                pass
            else:
                result = 'No'


    return result


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()

Submission status: Accepted

Solution code:
s=str(input())
hantei0=True
hantei1=True

for i in range(len(s)):
  if i%2==0 and s[i]=='L':
    hantei0=False
  elif i%2==1 and s[i]=='R':
    hantei1=False
    
if hantei0==True and hantei1==True:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

judge = 'Yes'

for i in range(len(S)) :
  if (i+1)%2 == 0 :
    if S[i] == 'R' :
      judge = 'No'
    else :
      judge = judge
  if (i+1)%2 == 1 :
    if S[i] == 'L' :
      judge = 'No'
    else :
      judge = judge

print(judge)

Submission status: Accepted

Solution code:
s = input()

flag = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s=='L':
  print('No')
  exit()
for i in range(0,len(s),2):
  for j in range(1,len(s),2):
    if s[i] not in 'RUD' or s[j] not in 'LUD':
      print('No')
      exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
# input
S = input()
flag = True
count = 1

for s in S:
    if count % 2 == 1:
        if (s != 'R') and (s != 'U') and (s != 'D'):
            flag = False
            break
    if count % 2 == 0:
        if (s != 'L') and (s != 'U') and (s != 'D'):
            flag = False
            break
    count += 1

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

Submission status: Accepted

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

str = input().strip()
flag = True

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

Submission status: Accepted

Solution code:
dance=input()
i=1
easydance=True
for dancestep in dance:
   if i%2==1:
       if dancestep=="L":
           easydance=False
   elif i%2==0:
       if dancestep=="R":
           easydance=False
   i+=1

if easydance==True:
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
Ls =len(s)
E = ""
O = ""

for i in range(Ls):
    if i%2 == 0:
        O = O + s[i]
    else:
        E = E + s[i]
Om = O.replace("L","")
Em = E.replace("R","")

if len(O)==len(Om) and len(E)==len(Em):
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def solve(S):
    for i, s in enumerate(S):
        if i % 2 == 1 and s == 'R':
            return 'No'
        if i % 2 == 0 and s == 'L':
            return 'No'
    return 'Yes'


if __name__ == '__main__':
    S = input()

    answer = solve(S.strip())
    print(answer)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
n = str(input())

length = len(n)
flg = 0
for num in range(length):
    if (num+1)%2!=0:
        if n[num] == 'R' or n[num] == 'U' or n[num] == 'D':
            flg = 1
        else:
            flg = 0
            break
    else:
        if n[num] == 'L' or n[num] == 'U' or n[num] == 'D':
            flg = 1
        else:
            flg = 0
            break
if flg == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

length = len(S)
evenN = []
oddN = []
for i in range(length):
    if (i + 1) % 2 == 0:
        if S[i] == 'R':
            evenN.append(False)
        else:
            evenN.append(True)
    if (i + 1) % 2 == 1:
        if S[i] == 'L':
            oddN.append(False)
        else:
            oddN.append(True)


if all(oddN) is True and all(evenN) is True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

tap_pattern = input()
taps_odd = ["R", "U", "D"]
taps_even = ["L", "U", "D"]
easy = True

for i in range(1,len(tap_pattern)+1):
  if i%2 == 0:
    if tap_pattern[i-1] not in taps_even:
      easy = False
  elif i%2 != 0:
    if tap_pattern[i-1] not in taps_odd:
      easy = False

if easy == True:
  result = "Yes"
else:
  result = "No"
  
print(result)

Submission status: Accepted

Solution code:
S = input()

ki = 1
gu = 1

j = 1
count = 0
for s in S:
    count = 0
    if j == 1 and count == 0:
        count = 1
        j = 0
        if s == "R":
            pass
        elif s == "U":
            pass
        elif s == "D":
            pass
        else:
            ki = 0


    if j == 0 and count == 0:
        count =1
        j = 1
        if s == "L":
            pass
        elif s == "U":
            pass
        elif s == "D":
            pass
        else:
            gu = 0


    if ki == 0:
        break
    if gu == 0:
        break

if ki + gu == 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
text = list(input())

text_1, text_2 = list(text), list(text)
for i in range(int(len(text)/2)):
    text_1.pop(i)
    text_2.pop(i+1)
if len(text) % 2 == 1:
    text_1.pop(len(text_1)-1)

str_1, str_2 = "", ""
for i in range(len(text_1)):
    str_1 += str(text_1[i])
for i in range(len(text_2)):
    str_2 += str(text_2[i])

if str_2.find('L') == -1 and str_1.find('R') == -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()

def evenjudge(obj):
    if obj %2!=0:
        return 1
    else:
        return 2
def oddjudge(obj):
    if obj %2!=0:
        return 2
    else:
        return 1

lo=[i for i in range(0,110,2)]
le=[i for i in range(1,110,2)]

oeflag=evenjudge(len(s))
eoflag=oddjudge(len(s))
for j in lo:
    if s[j] == "L":
        print("No")
        exit(0)
    if j == len(s)-oeflag:
        break


for k in le:
    if len(s)==1:
        break
    if s[k] == "R":
        print("No")
        exit(0)
    if k == len(s)-eoflag:
        break


print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = list(input())

#奇数
odd_list = ['R','U','D']
#偶数
even_list = ['L','U','D']

for i in range(len(S)):
	#偶数
	if (i+1) % 2 == 0:
		if S[i] not in even_list:
			print('No') 
			sys.exit()
	#奇数
	else:
		if S[i]  not in odd_list:
			print('No')
			sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
s = list(str(input()))
odd = s[1::2]
g = s[0::2]
if bool("L" in g) == False and bool("R" in odd )== False:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
len_s = len(S)
cnt = 0
flag = True
even_list = ["L","U","D"]
odd_list = ["R","U","D"]
for i in S:
  cnt += 1
  if cnt%2 == 0 and i in even_list:
    pass
  elif cnt%2 == 1 and i in odd_list:
    pass
  else:
    flag = False

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
ans = "Yes"
for i in range(len(S)):
    if (i+1)%2 == 1:
        if S[i] not in "RUD":
            ans = "No"
            break
    else:
        if S[i] not in "LUD":
            ans = "No"
            break
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
cnt_yes = 0
for i, s in enumerate(S):
    if (i+1) % 2 == 0:
        if s == 'L' or s == 'U' or s == 'D':
            cnt_yes += 1
    else:
        if s == 'R' or s == 'U' or s == 'D':
            cnt_yes += 1

if cnt_yes == len(S):
    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":
			print("No")
			flag = 1
			break
	else:
		if str[i] == "R":
			print("No")
			flag = 1
			break

if flag == 0:
	print("Yes")
	pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(open(0).read())
odd  = S[0::2]
even = S[1::2]

uo = set(odd)
ue = set(even)

if('L' in uo or 'R' in ue):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
def main():
  ch=input()
  l=len(ch)
  for i in range(l):
    if(i%2==0 and (ch[i]!='R' and ch[i]!='U' and ch[i]!='D')):
      print('No')
      break
    elif(i%2==1 and (ch[i]!='L' and ch[i]!='U' and ch[i]!='D')):
      print('No')
      break
    elif(i==l-1):
      print('Yes')
  
main()

Submission status: Accepted

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

S = str(input())

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

Submission status: Accepted

Solution code:
S = input()
result = "Yes"
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            result = "No"
            break
    elif i % 2 != 0:
        if S[i] == "R":
            result = "No"
            break
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if set(S[::2])-set("RUD") == set(S[1::2])-set("LUD") == set():
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

x = 0

hoge = ['R','L']
ans = 'Yes'

for i in range(len(S)):
    if(S[i] == hoge[(i+1)%2]):
        ans = 'No'
        break

print(ans)

Submission status: Accepted

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

    odd_list = [] # 奇数
    even_list = [] # 偶数

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

    if 'L' not in odd_list and 'R' not in even_list:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    Tap_Dance_abc141()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

k = ['L','U','D']
g = ['R','U','D']

for i in range(len(s)):
	if i % 2 == 0:
		if s[i] in g:
			pass
		else:
			print('No')
			exit()
	else:
		if s[i] in k:
			pass
		else:
			print('No')
			exit()
print('Yes')

Submission status: Accepted

Solution code:
good_odd = ['R', 'U', 'D']  # Kisuu, Right
good_even = ['L', 'U', 'D']  # Guusuu, Left
is_Right_good = True
is_Left_good = True
S = list(input().rstrip())
result = False
for i, s in enumerate(S, start=1):
    if i % 2 == 0 and is_Left_good:
        if s not in good_even:
            is_Left_good = False
    elif i % 2 == 1 and is_Right_good:
        if s not in good_odd:
            is_Right_good = False
if is_Right_good and is_Left_good:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import collections
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
import math
S = raw_input()
S = list(S)
for idx, val in enumerate(S):
    if idx & 1:
        if val not in ('L', 'U', 'D'):
            print('No')
            exit()
    else:
        if val not in ('R', 'U', 'D'):
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
dance = input()

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

print("Yes")

Submission status: Accepted

Solution code:
S = input()

Odd= S[0::2]
Even= S[1::2]

oddset  = {'R', 'U', 'D'}
evenset = {'L', 'U', 'D'}

if oddset >= set(Odd) and evenset >= set(Even):
    ans = 'Yes'
else :
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
moji = input().rstrip()
mojilist = list(moji)
evenset = set()
oddset = set()

for i in range(len(mojilist)):
  if i % 2 == 0:
    oddset.add(mojilist[i])
  else:
    evenset.add(mojilist[i])

if ((oddset <= {"R","U","D"}) and (evenset <= {"L","U","D"})):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_string = list(input())
# print(input_string)

flg = 0

for num, char in enumerate(input_string):
    if num%2 == 0:
#         print('odd', num, char)
        if (char != 'R') and (char != 'U') and (char != 'D'):
            flg = 1
    else:
#         print('even', num, char)
        if (char != 'L') and (char != 'U') and (char != 'D'):
            flg = 1

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

Submission status: Accepted

Solution code:
g = ['L', 'U', 'D']
k = ['R', 'U', 'D']
a = input()
b = 0
for i in range(len(a)):
    if (i+1) % 2 == 0:
        if a[i] in g:
            pass
        else:
            print('No')
            b = 1
            break
    else:
        if a[i] in k:
            pass
        else:
            print('No')
            b = 1
            break
if b == 0:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
flag = 'Yes'

for i in range(len(s)):
    if i%2==1 and s[i]=='R':
        flag = 'No'
        break
    elif i%2==0 and s[i]=='L':
        flag = 'No'
        break

print(flag)

Submission status: Accepted

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

print(b)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S=str(input())
n=len(S)
p=0
if(n==1):
    if(S=="L"):print("No")
    else:print("Yes")
else:
    for i in range(1,n,2):
        if(S[i-1]=="L"):
            print("No")
            break
        if(S[i]=="R"):
            print("No")
            break
        else: p+=1
    if(p == n//2):print("Yes")

Submission status: Accepted

Solution code:
n = str(input())
d = []
p = []
i = 1
s = 1
l = 1
for k in n:
 if i % 2 == 0:
  if k == "L" or k == "U" or k == "D":
   pass
  else:
   s = 0
 else:
  if k == "R" or k == "U" or k == "D":
   pass
  else:
    l = 0
 i = i + 1
#print(s,l)
if s and l == 1:
 print("Yes")
else:
 print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

s = list(s)
s1=s[0::2]
s2=s[1::2]

flag = "Yes"

for a in s1:
  if (a != 'R') and (a != 'U') and (a != 'D'):
    flag = "No"
for a in s2:
  if (a != 'L') and (a != 'U') and (a != 'D'):
    flag = "No"

print(flag)

Submission status: Accepted

Solution code:
Dance = input()

import re

pattern1 = r"[^RUD]"
pattern2 = r"[^LUD]"

if re.search(pattern1, Dance[0::2]) or re.search(pattern2, Dance[1::2]):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
S = input()


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


print("Yes" if isEasy(S) else "No")

Submission status: Accepted

Solution code:
S = input()

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

print(flag)

Submission status: Accepted

Solution code:
S=input()

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

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

Submission status: Accepted

Solution code:
S=input()
x=0
if len(S)%2==1:
 for i in range(len(S)//2+1):
  if S[2*i]=='L':
   x= x+1
  else:
   x= x
else:
 for i in range(len(S)//2):
  if S[2*i]=='L':
    x= x+1
  else:
    x= x

for j in range(len(S)//2):  
  if S[2*j+1]=='R':
   x= x+1
  else:
   x= x
    
if x==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

hard = 0
#S = "RDULULDURURLRDULRLR"

for i in range(len(S)):
    moji = S[i]
    if i % 2 == 1:
#        print("{} th : {} is in  Kisu(R,U,D)".format(i,moji))
        if moji not in gusu:
            hard = 1
            break
    if i % 2 == 0:
#        print("{} th : {} is in Gusu(L,U,D)".format(i,moji))
        if moji not in kisu:
            hard = 1
            break
if hard == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import os

S = input()

for i in range(0,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:
N=list(input())
H=[]
for i in range(len(N)) :
    if N[i] == "U" or N[i] == "D" :
            pass
    else:
        if i % 2 == 1 :
            if N[i] == "L" :
                pass
            else :
                H.append("No")
        else:
            if N[i] == "R" :
                pass
            else :
                H.append("No")
if "No" in H :
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
b = len(x)
ans = ''
for a in range(0,b,2):
    if x[a] == 'R' or x[a] == 'D' or x[a] == 'U':
        ans = 'Yes'
    else:
        ans = 'No'
        break
for a in range(1,b,2):
    if ans == 'No':
        break
    elif x[a] == 'L' or x[a] == 'D' or x[a] == 'U':
        ans = 'Yes'
    else:
        ans = 'No'
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = input()
f1 = s[::2].find('L')
f2 = s[1::2].find('R')
if f1 == -1 and f2 == -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans ='Yes'

for i in range(N):
	if i%2 == 0:
		if S[i] == 'L' :
			ans = 'No'
	elif i%2 == 1:
		if S[i] == 'R' :
			ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input().strip()
    taps = [('R', 'U', 'D'), ('L', 'U', 'D')]
    cannot_taps = ['L', 'R']
    all_can_taps = True
    for i in range(len(S)):
        if S[i] == cannot_taps[i % 2]:
            all_can_taps = False
    print('Yes' if all_can_taps else 'No')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# python3

def tap_easy_detector(tap_list):
	kisuu={"R", "U", "D"}
	gusu={"L", "U", "D"}

	tap_gusu_set= set(tap_list[0::2])
	tap_kisuu_set= set(tap_list[1::2])

	if tap_kisuu_set <= gusu and tap_gusu_set<= kisuu:
		return "Yes"
	else:
		return "No"

if __name__ == '__main__':
    Sequence = input()
    input_list = list(Sequence)
    print(tap_easy_detector(input_list))

Submission status: Accepted

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

se = s[0::2]
so = s[1::2]

if ('L' in se):
  print('No')
elif ('R' in so):
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

A = ['Yes','No']
k = 0
glist = ['R','U','D']
klist = ['L','U','D']

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

print(A[k])

Submission status: Accepted

Solution code:
S = input()
count = True
for i,s in enumerate(S):
    if i%2 == 0:
        if s != 'R' and s != 'U' and s != 'D':
            count = False
            break
    if i%2 != 0:
        if s != 'L' and s != 'U' and s != 'D':
            count = False
            break
            
if count == False:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
steps = list(list(input()))
even = True
odd = True
for i in range(0, len(steps), 2):
    if not (steps[i] == 'R' or  steps[i] == 'U' or  steps[i] == 'D'):
        odd = False

for i in range(1, len(steps), 2):
    if not (steps[i] == 'L' or  steps[i] == 'U' or  steps[i] == 'D'):
        even = False

if even and odd:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
count = 0

for i, char in enumerate(s):
    if (i+1)%2 == 0:
        if char == 'R':
            count = count + 1
    elif (i+1)%2 == 1:
        if char == 'L':
            count = count + 1

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

Submission status: Accepted

Solution code:
s = list(input())

k = sorted(set(s[0::2]))
g = sorted(set(s[1::2]))

if 'L' in k or 'R' in g:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = str(input())
result = []

for i in range(len(s)):
    if(i%2==0):
        odd = any((s[i]== x for x in ['R','U','D']))
        result.append(odd)
    else:
        even = any((s[i]== x for x in ['L','U','D']))
        result.append(even)

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
order = list(map(str, input()))

ans_list = []
for i in range(len(order)):
    if i % 2 == 1:
        if order[i] in ['L', 'U', 'D']:
            ans = True
        else:
            ans = False
        ans_list.append(ans)
    else:
        if order[i] in ['R', 'U', 'D']:
            ans = True
        else:
            ans = False
        ans_list.append(ans)
        
if False in ans_list:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
ki = {"R","U","D"}
gu = {"L","U","D"}

n = str(input())
n_l = len(n)
N = []
for i in range(n_l):
    N.append(n[i])

n_ki = set(N[::2])
n_gu = set(N[1::2])
if n_ki.issubset(ki) and n_gu.issubset(gu):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
result = 'Yes'
for i in range(len(S)):
    if(i%2 != 0):
        if(S[i] != 'L' and S[i] != 'U' and S[i] != 'D'):
            
            result = 'No'
            break
    else:
        if(S[i] != 'R'and S[i] != 'U' and S[i] != 'D'):
            
            result = 'No'
            break

print(result)

Submission status: Accepted

Solution code:
strings = input()
l = len(strings)
even = []
odd = []
i = 0
while i <= l:
  try:
    odd.append(strings[i])
  except:
    pass
  try:
    even.append(strings[i+1])
  except:
    pass
  i += 2

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

Submission status: Accepted

Solution code:
S = input()
ans = True

i = 0
while i < len(S):
    if i % 2 == 0 and S[i]=="L":
        ans = False
    elif i % 2 == 1 and S[i]=="R":
        ans = False
    else:
        t = 1
    i += 1
   
if ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(int(1e6))

S = input()

for i in range(len(S)):
    if i % 2:
        # 偶数番目
        if S[i] == 'R':
            print('No')
            exit()
    else:
        # 奇数番目
        if S[i] == 'L':
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
S = list(input())
A = []

for i,x in enumerate(S):
    if (i+1)%2 == 0 and x == "R":
        A.append("No")
    elif (i+1)%2 == 1 and x == "L":
        A.append("No")
    else:
        A.append("Yes")

if "No" in A:
    print("No")
else:
    print("Yes")