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()
ans=True
for i in range(len(S)):
    if((i+1)%2==1):
        if(not(S[i]=="R" or S[i]=="U" or S[i]=="D")):
            ans=False
            continue
    else:
        if (not (S[i] == "L" or S[i] == "U" or S[i] == "D")):
            ans = False
            continue

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s1 = input()
r1 = "Yes"

for i1 in range(len(s1)):
    if i1 % 2 == 0:
        if s1[i1] == "L":
            r1 = "No"
    else:
        if s1[i1] == "R":
            r1 = "No"

print(r1)

Submission status: Accepted

Solution code:
N = input()

result = 'Yes'
for i in range(len(N)):
    s = N[i]
    if (i+1)%2 == 1 :
        if s !='R' and s != 'U' and s != 'D':
            result = 'No'
            break
    elif (i+1)%2 == 0:
        if s !='L' and s != 'U' and s != 'D':
            result = 'No'
            break

print(result)

Submission status: Accepted

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


def main():
    arr =input()
    even = arr[0::2]
    odd = arr[1::2]

    even = even.replace("U","")
    even = even.replace("D","")
    even = even.replace("R","")

    if len(even) > 0:
        print("No")
        sys.exit()

    odd = odd.replace("U","")
    odd = odd.replace("D","")
    odd = odd.replace("L","")

    if len(odd) > 0:
        print("No")
    else:
        print("Yes")










if __name__ =='__main__':
    main()

Submission status: Accepted

Solution code:
s=str(input())
if len(s)==1:
	if s[0]=='L':
		print('No')
	else:
		print('Yes')
else:		
	ans='Yes'
	i=0
	while 2*i+1<len(s):
		if s[2*i]=='L':
			ans='No'
		if s[2*i+1]=='R':
			ans='No'
		i+=1
	print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())
p=0
a='Yes'
for i in s:
    if p%2==0:
        if i=='L':
            a='No'
            break
    else:
        if i=='R':
            a="No"
            break
    p+=1
print(a)

Submission status: Accepted

Solution code:
s=input()
o=["R","U","D"]
e=["L","U","D"]
i=0
for t in range(len(s)):
  if(i==1):
    break
  if(t%2==0):
    if(s[t] not in o):
      print("No")
      i=1
      break
  else:
    if(s[t] not in e):
      print("No")
      i=1
      break
if(i==0):
	print("Yes")

Submission status: Accepted

Solution code:
s = input()

count = 0

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

if count == len(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
    S = input()
    Even = []
    Odd = []

    for i in range(len(S)):
        if i % 2 == 0:
            Even.append(S[i])
        else:
            Odd.append(S[i])

    if not Even.__contains__("L") and not Odd.__contains__("R"):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
li = list(S)
ans = 'Yes'
for i, a in enumerate(li):
    if (i+1)%2 == 1:
        if a == 'L':
            ans = 'No'
            #break
    else:
        if a == 'R':
            ans = 'No'
            #break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

S = list(input())

for i, s in enumerate(S):
    if (i + 1) % 2 == 0:
        if s not in even:
            print('No')
            exit()
    else:
        if s not in odd:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
tap = input()

odd = tap[0:len(tap):2]
even = tap[1:len(tap):2]

if odd.count('R')+odd.count('U')+odd.count('D')==len(odd) and even.count('L')+even.count('U')+even.count('D')==len(even):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
c = 0
lste = []
lsto = []

for i in range(len(s)):
  if i%2 == 0:
    lsto.append(s[i])
  if i%2 != 0:
    lste.append(s[i])
      
if "L" not in lsto and "R" not in lste:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
'use strict'
S = input()

result = 'Yes'

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

print(result)

Submission status: Accepted

Solution code:
s = str(input())
o = set()
e = set()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in ["R","U","D"]:
            pass
        else:
            print("No")
            exit()
    else:
        if s[i] in ["L","U","D"]:
            pass
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = 0
ans = ['Yes', 'No']

for (i,s) in enumerate(S):
    num = i+1
    if num%2 == 1:
        if s == 'L':
            flag = 1
    elif num%2 == 0:
        if s == 'R':
            flag = 1
print(ans[flag])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    odd = ['R', 'U', 'D']
    evn = ['L', 'U', 'D']

    res = YES
    for i, l in enumerate(S):
        if i%2 != 0:
            if not l in evn:
                res = NO
        else:
            if not l in odd:
                res = NO
    print(res)


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    ans = 'Yes'
    for i in range(len(S)):
        if (i+1) % 2 != 0 and S[i] == 'L':
            ans = 'No'
            break

        if (i+1) % 2 == 0 and S[i] == 'R':
            ans = 'No'
            break
    
    print(ans)

if __name__ == '__main__':
    func()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
cnt = 1
for s in S:
  if cnt%2== 1:
    if s in ["R","U","D"]:
      cnt += 1
    else:
      print('No')
      break
  elif cnt%2==0:
    if s in ["L","U","D"]:
      cnt += 1
    else:
      print('No')
      break
else:
  print('Yes')

Submission status: Accepted

Solution code:
s=list(input())
a=s[::2]
b=s[1::2]
if a.count('R')+a.count('U')+a.count('D')==len(a) and b.count('L')+b.count('U')+b.count('D')==len(b):
    print('Yes')
    exit()
print('No')

Submission status: Accepted

Solution code:
s=list(input())
c = 0
humi = 0
for i in s:
    if c%2 == 0:
        if i == 'L':
            humi = 1
            break
    if c%2 == 1:
        if i == 'R':
            humi = 1
            break
    c += 1
print('Yes' if humi == 0 else 'No')

Submission status: Accepted

Solution code:
s = input()

odd = set(s[::2])
even = set(s[1::2])

judge = (odd <= {'R', 'U', 'D'}) and (even <= {'L', 'U', 'D'})

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=str(input())
ans="Yes"
for i,s in enumerate(S):
  if i%2==0:#odd
    if s=="L":
      ans="No"
      break
  else:#even
    if s=="R":
      ans="No"
      break
print(ans)

Submission status: Accepted

Solution code:
s = input()
flag = True

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] not in "RUD":
      flag = False
      break
  else:
    if s[i] not in "LUD":
      flag = False
      break

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

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    if i % 2:# 偶数番目
        if s[i] == 'R':
            print("No")
            exit(0)
    if i % 2 == 0:
        if s[i] == 'L':
            print("No")
            exit(0)
print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(str(input()))
ans = "Yes"
for i, n in enumerate(s):
  if i % 2 == 0:
    if n == "R" or n == "U" or n == "D":
      continue
    else:
      ans = "No"
  else:
    if n == "L" or n == "U" or n == "D":
      continue
    else:
      ans = "No"
print(ans)

Submission status: Accepted

Solution code:
s = input()
odd = []
even = []

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

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

Submission status: Accepted

Solution code:
steps = list(input())

gusu_steps = set(steps[0::2])
kisu_steps = set(steps[1::2])

if ('L' in gusu_steps) or ('R' in kisu_steps):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

for i, si in enumerate(s):

    if (i+1)%2==0 and si in "LUD":
        continue
    elif (i+1)%2==1 and si in "RUD":
        continue
    else:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
s = list(input())

even_s_list = ['R', 'U', 'D']
odd_s_list = ['L', 'U', 'D']
result = 'Yes'
for i, c in enumerate(s):
    if (i % 2 == 0) and not (c in even_s_list):
        result = 'No'
        break
    if (i % 2 == 1) and not (c in odd_s_list):
        result = 'No'
        break

print(result)

Submission status: Accepted

Solution code:
inp = input ()

inplist = [char for char in inp]

playable = True

for i in range (0,len(inplist)):
    if i%2 == 0:
        if inplist[i] not in ('RUD'):
          playable = False
          break
    else:
        if inplist[i] not in ('LUD'):
          playable = False
          break

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

Submission status: Accepted

Solution code:
S=input()

good=True

for i, s in enumerate(S):
  if (i+1)%2==0:
    if s in ['L','U','D']:
      pass
    else:
      good=False
  else:
    if s in ['R','U','D']:
      pass
    else:
      good=False
  
if good:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = input()
S += "UUU"
humiyasui = True
for i in range(0,len(S)-1,2):
    if S[i] == "L":
        humiyasui = False
    if S[i+1] == "R":
        humiyasui = False

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    for i in range(len(S)):
        if(i%2 == 0 and S[i] in ('R', 'U', 'D')):
            continue
        elif(i%2 == 1 and S[i] in ('L', 'U', 'D')):
            continue
        else:
            # print(i)
            print(NO)
            exit()
    print(YES)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
#coding:utf-8

s = input()
tap = list(s)
e_tap = tap[1::2]
o_tap = tap[0::2]
#print(o_tap, e_tap)
o = 0
e = 0
for i in e_tap:
    if i == 'R':
        o = 1
        break

for i in o_tap:
    if i == 'L':
        e = 1
        break

if o == 0 and e == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

S = input().strip()
ans = 1
odd = set(['R', 'U', 'D'])
even = set(['L', 'U', 'D'])

for i, letter in enumerate(S):
    i += 1
    if i % 2 == 1:
        if letter not in odd:
            ans *= 0
    if i % 2 == 0:
        if letter not in even:
            ans *= 0

if ans == 1:
    print('Yes')
elif ans == 0:
    print('No')

Submission status: Accepted

Solution code:
S = input()
kisuu = S[::2]
guusuu = S[1::2]

if "L" not in kisuu:
    if "R" not in guusuu:
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
odd = [ "R", "U", "D"]
add = ["L", "U", "D"] 
ans = 1
 
S = input()
for i,s in enumerate(S):
  if (i+1)%2 == 0:
    if (s in add) == False:
      ans = 0
  else:
    if (s in odd) == False:
      ans = 0
      
if ans == 0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
S = input()

ans1 = 0
ans2 = 0

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

if ans1 + ans2 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

flag = True

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

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

Submission status: Accepted

Solution code:
s = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
isEasy = True
for i, t in enumerate(s):
    if i % 2 == 0 and not t in odd:
        isEasy = False
        break
    elif i % 2 != 0 and not t in even:
        isEasy = False
        break
if isEasy:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
S = input()
ans = "Yes"
for i, c in enumerate(S):
  if (i + 1) % 2 == 1:
    if not c in ["R", "U", "D"]:
      ans = "No"
      break
  if (i + 1) % 2 == 0:
    if not c in ["L", "U", "D"]:
      ans = "No"
      break
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque


def main():
    S = input()

    o = ['R', 'U', 'D']
    e = ['L', 'U', 'D']

    counter = 0
    for i in range(len(S)):
        if (i+1) % 2 == 1 and S[i] in o or (i+1) % 2 == 0 and S[i] in e:
            counter += 1
    if counter == len(S):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
tmp = 0
ans = 'Yes'
flag = True

while(tmp < n):
  if(tmp%2 == 0):
    if(s[tmp] == 'R' or s[tmp] == 'U' or s[tmp] == 'D'):
      pass
    else:
      flag = False
      break
  else:
    if(s[tmp] == 'L' or s[tmp] == 'U' or s[tmp] == 'D'):
      pass
    else:
      flag = False
      break
  if flag == False:
    ans = 'No'
    break
  tmp += 1
if flag == False:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
s=list(input())
extract1 = s[::2]
extract2 = s[1::2]

if extract1.count('L')!=0:
    print('No')
elif extract2.count('R')!=0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

odd_flg = True
even_flg = True

for i in range(len(s)):
    # odd
    S = s[i:i+1]
    if i%2 == 0:
        if S not in odd:
            odd_flg = False
    elif i%2 == 1:# even
        if S not in even:
            even_flg = False
if odd_flg == True and even_flg == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

s = list(map(str, input()))
for w in range(1, len(s), 2):
    if 'R' in s[w]:
        print("No")
        exit()

for w in range(0, len(s), 2):
    if 'L' in s[w]:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
S=input()
N=len(S)
count=0
if N%2==0:
    for i in range(0,N//2):
        if S[2*i]=="L" or S[2*i+1]=="R":
            count=1
else:
    for i in range(0,N//2):
        if S[2*i]=="L" or S[2*i+1]=="R":
            count=1
    if S[N-1]=="L":
            count=1
if count==1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
hantei = [False]*N
check = True
for i in range(1, N+1):
    if i % 2 :
        if (S[i-1] == "R") | (S[i-1] == "U") | (S[i-1] == "D") :
            hantei[i-1] = True
        else:
            hantei[i-1] = False
    else:
        if (S[i-1] == "L") | (S[i-1] == "U") | (S[i-1] == "D") :
            hantei[i-1] = True
        else:
            hantei[i-1] = False

for i in range(N):
    if hantei[i] == False:
        check = False
            
if check :
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# B - Tap Dance
S = str(input())
ans =''
for i in range(len(S)):
    if (i+1) % 2 == 0:
        if S[i] != 'R':
            ans = 'Yes'
        else:
            ans = 'No'
            print(ans)
            exit()
    else:
        if S[i] != 'L':
            ans = 'Yes'
        else:
            ans = 'No'
            print(ans)
            exit()

print(ans)

Submission status: Accepted

Solution code:
S = input()

ans = "Yes"

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S=list(input())
a=S[0::2]
b=S[1::2]


A=['R','U','D']
B=['L','U','D']
for i in a:
    if i in A:
        continue
    else:
        print('No')
        sys.exit()
for i in b:
    if i in B:
        continue
    else:
        print('No')
        sys.exit()
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
# print(s)
# print(len(s))
for i in range(len(s)):
    c=s[i:i+1]
    if i % 2 !=0:
        if c == 'R':
            # print(i,c,'No')
            print('No')
            exit(0)
    else:
        if c == 'L':
            # print(i,c,'No')
            print('No')
            exit(0)
print('Yes')

Submission status: Accepted

Solution code:
S = str(input())

str_data = list(S)

jdg_flag = 0

for i in range(0,len(str_data),2):
  if str_data[i] == 'L':
    jdg_flag = 1
    
for i in range(1,len(str_data),2):
  if str_data[i] == 'R':
    jdg_flag = 1
    
if jdg_flag == 0:
  out = 'Yes'
else:
  out = 'No'

  
print(out)

Submission status: Accepted

Solution code:
dance = input()
dance1 = [i for i in dance]
check_n = 0
for j in range(len(dance1)):
    if(j%2==0):
        if((dance1[j]=="L")):
            check_n = 1
            break
    else:
        if((dance1[j]=="R")):
            check_n = 1
            break

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

Submission status: Accepted

Solution code:
S = input()
  
judge = 'Yes'
count = 1
for item in S:
  if count % 2 == 1:
    if item == 'L':
      judge = 'No'
      break;
  if count % 2 == 0:
    if item == 'R':
      judge = 'No'
      break;

  count += 1

print(judge)

Submission status: Accepted

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

# 奇数番目
odd = S[0::2]

# 偶数ばんめ
even = S[1::2]

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

Submission status: Accepted

Solution code:
s = input()
flag = True
count = 1
for i in s:
    if (count % 2 == 1) and ( i == 'L'):
        flag = False
        count += 1
    elif (count % 2 == 0) and (i == 'R'):
        flag = False
        count += 1
    else:
        count += 1
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s =  input()
res = 'Yes'
if 'R' in s[1::2]:
    # gu
    res = 'No'
if 'L' in s[::2]:
    # ki
    res = 'No'
print(res)

Submission status: Accepted

Solution code:
while True:
    try:
        S = input()
        for i, j in enumerate(S):
            if i % 2 == 1:
                if j != 'L' and j != 'U' and j != 'D':
                    print("No")
                    break
            else:
                if j != 'R' and j != 'U' and j != 'D':
                    print("No")
                    break
        else:
            print("Yes")
    except EOFError:
        break

Submission status: Accepted

Solution code:
s = list(input())
kisu = True
res = "Yes"
for ss in s:
    if kisu:
        if ss == "L":
            res = "No"
            break
        kisu = False
    else:
        if ss == "R":
            res = "No"
            break
        kisu = True
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
i1 = S[1:len(S):2]
i2 = S[0:len(S):2]
if "L" not in i2 and "R" not in i1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())

a = [1]
for i in range(len(s)):
	k = i % 2
	if k ==0:
		if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
			a.append(1)
		else:
			a.append(0)
	else:
		if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
			a.append(1)
		else:
			a.append(0)

if min(a) == 0:
	ans = 'No'
else:
	ans = 'Yes'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a="RUD"
b="LUD"
print("Yes" if sum([i in a for i in s[0::2]])==len(s)//2+len(s)%2 and sum([i in b for i in s[1::2]])==len(s)//2 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

S = read()
Odd = S[0::2]
Even = S[1::2]

if ("L" not in Odd) and ("R" not in Even):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

s=input().rstrip()
g=s[1::2]
k=s[0::2]
if "L" in k or "R" in g:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys

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

print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    S = input()

    y = "Yes"
    n = "No"

    rud = ["R", "U", "D"]
    lud = ["L", "U", "D"]
    for i, s in enumerate(S):
        j = i + 1
        if j % 2 == 1:
            if s not in rud:
                return n
        else:
            if s not in lud:
                return n

    return y


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
s_s = list(input())
odd  = set(['R', 'U', 'D'])
even = set(['L', 'U', 'D'])
ans = 'Yes'
for i, s in zip(range(1, len(s_s) + 1), s_s):
  if (i % 2 == 0 and s not in even) or (i % 2 == 1 and s not in odd):
      ans = 'No'
      break
print(ans)

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()


def main():
    S = input()

    odd = True
    for x in S:
        chars = 'RUD' if odd else 'LUD'
        if x not in chars:
            print('No')
            return
        odd = not odd
    print('Yes')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
ch = ('L','R')
c = 1
ans = "Yes"
for i in s:
    if i == ch[min(0,c)]:
        ans = "No"
    c *= -1
print(ans)

Submission status: Accepted

Solution code:
s = input()

for index, step in enumerate(s):
    if index % 2 == 0 and step == "L":
        print('No')
        exit()
    if index % 2 == 1 and step == "R":
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()

fizz = list()
buzz = list()
for i in range(1, len(s) + 1):
    if i % 2 == 0:
        fizz.append(s[i-1])
    else:
        buzz.append(s[i-1])

boolean = 0
for i in range(len(fizz)):
    if fizz[i] == "R":
        print("No")
        boolean = 1
        break
if boolean != 1:
    for i in range(len(buzz)):
        if buzz[i] == "L":
            print("No")
            boolean = 1
            break

if boolean == 0:
    print("Yes")

Submission status: Accepted

Solution code:
#gcdは3.4.3だとfractionsにある
from fractions import gcd

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    kisuu = ['R','U','D']
    guusuu = ['L','U','D']
    flag = True
    
    s = input()
    for e,i in enumerate(s):
        if not e % 2:
            if not i in kisuu:
                flag = False
        else:
            if not i in guusuu:
                flag = False
    if flag:
        print('Yes')
    else:
        print('No')




main()

Submission status: Accepted

Solution code:
S = input()

odd = True
yes = True

for s in S:
    if odd:
        if s == "L":
            yes = False
            break
        odd = False
    else:
        if s == "R":
            yes = False
            break
        odd = True

# print(S)

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