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 = list(input())
n = len(s)

for i in range(n):
    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()

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

Submission status: Accepted

Solution code:
s=input()

sodd=[s[2*i] for i in range((len(s)+1)//2)]
seven=[s[2*i+1] for i in range((len(s))//2)]

if ("L" in sodd) or ("R" in seven):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

def tap(S):
    for i,s in enumerate(S):
        if ((i + 1)%2 != 0):
            if s in odd:
                continue
            else:
                print("No")
                return
        else:
            if s in even:
                continue
            else:
                print("No")
                return
    print("Yes")


S = list(input())
tap(S)

Submission status: Accepted

Solution code:
def main():
    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'
            break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
  line = input()
  
  ki = ['R', 'U', 'D']
  gu = ['L', 'U', 'D']

  for i in range(len(line)):
    if (i+1) % 2 == 0:
      if line[i] not in gu:
        print("No")
        return
    else:
      if line[i] not in ki:
        print("No")
        return
      
  print("Yes")
  return

main()

Submission status: Accepted

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

S = input()

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

for (i, step) in enumerate(S):
    if i % 2:
        if step not in even:
            print("No")
            exit()
    else:
        if step not in odd:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

Solution code:
S = input()
stepr = ["R", "U", "D"]
stepl = ["L", "U", "D"]
rstep = all([S[i] in stepr for i in range(0,len(S),2)])
lstep = all([S[i] in stepl for i in range(1,len(S),2)])
if rstep and lstep:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
check=0
for i in S[1::2]:
  if i in 'LUD':
    check+=1
for j in S[::2]:
  if j in 'RUD':
    check+=1
print('Yes' if check==len(S) else 'No')

Submission status: Accepted

Solution code:
def judgeOdd(x: str):
    if x != "L":
        return True
    else:
        return False


def judgeEven(x: str):
    if x != "R":
        return True
    else:
        return False


if __name__ == "__main__":
    s = input("")

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

    odd = list(map(judgeOdd, odd))
    even = list(map(judgeEven, even))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = 'Yes'
so = [s[i] for i in range(0,len(s),2)]
se = [s[i] for i in range(1,len(s),2)]

for i in so:
    if i == 'L':
        ans = 'No'

for i in se:
    if i == 'R':
        ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input().strip()

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

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

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:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            count += 1
if count == len(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
s=input()
l=len(s)
ans="Yes"
for i in range(l):
  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:
strs = input()
 
for i in range(len(strs)):
  if i % 2 != 0:
    if (strs[i] == "L") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
  else:
    if (strs[i] == "R") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S_list = list(input())
even = ['R','U','D']
odd = ['L','U','D']
odd1 = S_list[0::2]
even1 = S_list [1::2]

if 'L' in odd1 or 'R' in even1:
    print('No')

else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
a = [str(c) for c in s]


b = a[0::2]
c = a[1::2]


if "L" in b:
    d = False
else:
    d = True


if "R" in c:
    f = False
else:
    f = True

if d and f:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

odd_tap = ['R', 'U', 'D']
even_tap = ['L', 'U', 'D']

for i in range(len(S)):
    if i % 2 == 0:
        if not S[i] in odd_tap:
            print('No')
            exit()
    else:
        if not S[i] in even_tap:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()
count = 0
for i in range(len(S)):
    if((i+1)%2==1):
        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 = input()
B = False
for i in range(0, len(S)):
    if i % 2 == 0 and S[i] == "L":
        break
    elif i % 2 != 0 and S[i] == "R":
        break
else:
    B = True
if(B):
    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")
        exit(0)
    if (i+1)%2!=0 and s[i]=='L':
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

Solution code:
S = input()
odd = S[0::2]
even = S[1::2]
print("No" if 'L' in odd or 'R' in even else "Yes")

Submission status: Accepted

Solution code:
import sys

S = list(input())

Wid = len(S)

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

Submission status: Accepted

Solution code:
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall

S = input()
ans = True
for i in range(len(S)):
    if i % 2 == 0:#iが奇数の時
        if S[i] == 'L':
            ans = False
            break
    else:#iが偶数の時
        if S[i] == 'R':
            ans = False
            break

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

Submission status: Accepted

Solution code:
s=input()
x=0
for i in range(0,len(s),2):
  if s[i]=="L":
    x+=1
    
for j in range(1,len(s),2):
  if s[j]=="R":
    x+=1

if x==0:
  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 "L" == s[i]:
            ans = "No"
    if i % 2 != 0:
        if "R" == s[i]:
            ans = "No"
print(ans)

Submission status: Accepted

Solution code:
import sys
S = input()
Odd = []
Even = []
for i,s in enumerate(S):
    if (i+1) % 2 == 1:
        Odd.append(s)
    else:
        Even.append(s)

for odd in Odd:
    if odd == 'L':
        print('No')
        sys.exit()
for even in Even:
    if even == 'R':
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

ans='Yes'
for i in range(len(s)):
	if(i%2 == 0):
		#奇数
		if(s[i]=="L"):
			ans="No"
			break
	else:
		#偶数
		if(s[i]=="R"):
			ans="No"
			break
print(ans)

Submission status: Accepted

Solution code:
s = input()
id = 0
res = 'Yes'
for i in s:
    if id & 1 == 0 and i == 'L' or id & 1 == 1 and i == 'R':
        res = 'No'
        break
    id += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
letters = ["L", "R", "U", "D"]
odd = "RUD"
even = "LUD"
S = input()
i = 0
result = "Yes"
for s in S:
  if i % 2 == 0:
    if s not in odd:
      result = "No"
      break
  else:
    if s not in even:
      result = "No"
      break
  i+=1

print(result)

Submission status: Accepted

Solution code:
s = input()

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Tap Dance
S = str(input())

res = True
for i, ch in enumerate(S):
    if i%2 == 0:
        if ch == 'L':
            res = False
            break
    else:
        if ch == 'R':
            res = False
            break

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

Submission status: Accepted

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

S = input()
odd = True
even = True

for i in range(len(S)):
    if (i+1)%2==0:
        if S[i] == "R":
            even = False
    else:
        if S[i] == "L":
            odd = False
    if (odd and even) == False:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

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
      break
  else:
    if s[i]=="R":
      a+=1
      break
if a>0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S=str(input())

for a in range(len(S)):
    if a%2==0:
        if S[a]=='R' or S[a]=='U' or S[a]=='D':
            continue
    elif a%2==1:
        if S[a]=='L' or S[a]=='U' or S[a]=='D':
            continue
    
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
S=input()
i=0
while i<len(S):
  if i%2==0:
    if S[i]=="L":
      print("No")
      exit()
    else:
      i+=1
  else:
    if S[i]=="R":
      print("No")
      exit()
    else:
      i+=1
print("Yes")

Submission status: Accepted

Solution code:
S = list(input())

def check_humiyasu(S):
    count = 0

    for i in range(len(S)):
        if (i+1) % 2 == 0:
            if S[i] == "L" or S[i] == "U" or S[i] == "D":
                continue
            else:
                count += 1
                
                

        elif (i+1) % 2 != 0:
            if S[i] == "R" or S[i] == "U" or S[i] == "D":
                continue
            else:
                count += 1
                
                
    if count == 0:
        print("Yes")
    else:
        print("No")

check_humiyasu(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    s = args[0]
    return 'Yes' if (
        s[0::2].count('L') == 0 and
        s[1::2].count('R') == 0
    ) else 'No'


if __name__ == "__main__":
    print(solve(*[input() for _ in range(1)]))

Submission status: Accepted

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

odd_s = S[0::2]
even_s = S[1::2]
o,e = True,True
for i in odd_s:
    if i not in odd:
        o = False
for i in even_s:
    if i not in even:
        e = False
        
if o and e:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

check1 = ["R","U","D"]
check2 = ["L","U","D"]

check1_ = []
check2_ = []

for s in S[::2]:
  if s in check1:
    check1_.append(True)
  else:
    check1_.append(False)

for s in S[1::2]:
  if s in check2:
    check2_.append(True)
  else:
    check2_.append(False)

if all(check1_) and all(check2_):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
flag = True
for i, j in enumerate(s):
    if ( i+1) % 2 == 0:
        if not(j == "L" or j =="U" or j == "D"):
            flag = False
    else:
        if not(j == "R" or j =="U" or  j == "D"):
            flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

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

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

print('Yes')

Submission status: Accepted

Solution code:
S=input(); n=1; k=['R','U','D']; g=['L','U','D']
for i in S:
    if n%2==1:
        if i not in k:
            print('No')
            exit()
    else:
        if i not in g:
            print('No')
            exit()
    n+=1
print('Yes')

Submission status: Accepted

Solution code:
s = input()
flag = 0

for i in range(len(s)):
  if i%2 == 0 and s[i] == "L": #奇数文字目がL
    flag = 1
    break
  if i%2 == 1 and s[i] == "R": #偶数文字目がR
    flag = 1
    break

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

Submission status: Accepted

Solution code:
S=input()
odd =S[::2]
even=S[1::2]
if (set(odd) <= {'R', 'U', 'D'}) and (set(even) <= {'L', 'U', 'D'}):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
a = input()

iseasy = "Yes"
odd_l = ["R","U","D"]
even_l = ["L","U","D"]
try:
	for i in range(0,int(len(a)/2+1)):
		if a[2*i] in odd_l: 
			pass
		else: 
			iseasy = "No"
			break
		if a[2*i+1] in even_l: 
			pass
		else:
			iseasy = "No"
			break
except IndexError as e:
	pass
print(iseasy)

Submission status: Accepted

Solution code:
s = input().strip()

answer = "Yes"

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

print(answer)

Submission status: Accepted

Solution code:
S = list(input())

S_1 = S[0::2]
S_2 = S[1::2]

if "L" not in S_1 and "R" not in S_2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(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:
step = str(input())

odds = step[0:len(step):2]
even = step[1:len(step):2]

if "L" not in odds and "R" not in even:
    answer = "Yes"
else:
    answer = "No"

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()
flag = True
for i in range(len(S)):
    if (i+1) % 2 == 1:
        if not(S[i] in ('RUD')):
            #print(S[i]+":"+"not RUD!!")
            flag = False
            break
    else:
        if not(S[i] in ('LUD')):
            #print(S[i]+":"+"not LUD!!")
            flag = False
            break

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

Submission status: Accepted

Solution code:
S=list(input())
A=[]
B=[]
i=0
while i<len(S):
    if i%2==0:
        A += S[i]
    else:
        B += S[i]
    i+=1
if 'L' in A:
    print('No')
elif 'R' in B:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
x = input()
y = len(x)

def main(x,y):
  
  for i,st in enumerate(x):
    if (i+1)%2 == 0:
      if st == 'R':
        return "No"
    else:
      if st == 'L':
         return "No"
  return "Yes"

res = main(x,y)
print(res)

Submission status: Accepted

Solution code:
d_list = list( input("") )
i = 0
while(i < len(d_list) ):
  if i % 2 == 0:
    if d_list[i] == "L":
        break
  if i % 2 == 1:
    if d_list[i] == "R":
        break
  i += 1

if i == len(d_list):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = int(len(S))
i = 0
j = 0
K = []
I = []
while (2*i+1) < N:
    if S[(2*i+1)] == "L":
        K.extend([S[(2*i+1)]])
    elif S[(2*i+1)] == "U":
        K.extend([S[(2*i+1)]])
    elif S[(2*i+1)] == "D":
        K.extend([S[(2*i+1)]])
    i += 1
while (2*j) < N:
    if S[(2*j)] == "R":
        I.extend([S[(2*j)]])
    elif S[(2*j)] == "U":
        I.extend([S[(2*j)]])
    elif S[(2*j)] == "D":
        I.extend([S[(2*j)]])
    j += 1
if int(len(K)) + int(len(I)) == N:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
flag = True
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
for i in range(len(s)):
    if (i+1) % 2 == 1:
        if not(s[i] in odd):
            flag = False
    else:
        if not (s[i] in even):
            flag = False

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

Submission status: Accepted

Solution code:
S = input()
flg = True

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

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

Submission status: Accepted

Solution code:
s =input()
l, i  = len(s) + 1, 1
while i < l:
    if i % 2:
        if  s[i - 1] == 'L':
            break
    else:
        if s[i - 1] == 'R':
            break
    i += 1
if i == l:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())

for i, chr in enumerate(s):
    if (i%2 == 0 and chr == "L") or (i%2 == 1 and chr == "R"):
        print("No")
        exit()
    else:
        continue
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

s = []
for i in S:
  s.append(i)
#print(s)
cnt = 0
for i in range(len(S)):
  if i%2==1:
    if (s[i] == 'L')or(s[i] == 'U')or(s[i] == 'D'):
      cnt += 0
    else:
      cnt += 1
      break
  else:
    if (s[i] == 'R')or(s[i] == 'U')or(s[i] == 'D'):
      cnt += 0
    else:
      cnt += 1
      break
if cnt == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h = str(input())
h = list(h)
h2 = h[0::2]
h3 = h[1::2]
if 'L' in h2 or 'R' in h3 :
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans='Yes'
if l%2==0:
  h=int(l/2)
  for i in range(0,h):
    if S[2*i]=='L':
      ans='No'
      break
  for i in range(0,h):
    if S[2*i+1]=='R':
      ans='No'
      break
elif l==1:
  if S[0]=='L':
    ans='No'
else:
  h=int((l+1)/2)
  for i in range(1,h):
    if S[2*i-1]=='R':
      ans='No'
      break
  for i in range(0,h):
    if S[2*i]=='L':
      ans='No'
      break

print(ans)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
i = 0
while True:
    if i%2==0:
        if S[i]=='L':
            print('No')
            break
    elif i%2==1:
        if S[i]=='R':
            print('No')
            break
    i = i+1
    if i==N:
        print('Yes')
        break

Submission status: Accepted

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

Submission status: Accepted

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

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


def solve(S: str):
    l = list(S)
    odd = all([s in ['R', 'U', 'D'] for s in sorted(list(set(l[0::2])))])
    even = all([s in ['L', 'U', 'D'] for s in sorted(list(set(l[1::2])))])
    print(YES if odd and even else NO)
    return


# Generated by 1.1.6 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:
S = input()


char_list = list(S)


num=0
res = True # good
for c in char_list:
        num+=1
        if num%2 != 0 :
                if c in  ["R","U","D"]:
                        continue
        else:
                if c in  ["L","U","D"]:
                        continue
        res =False
        break

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

Submission status: Accepted

Solution code:
S=str(input())   #10文字

ans='Yes'

Odd=[i for i in range(1,len(S)+1) if i%2==1]
Even=[j for j in range(1,len(S)+1) if j%2==0]

Odd_right=['R','U','D']
Even_right=['L','U','D']

for k in Odd:
    if S[k-1] not in Odd_right:
        ans='No'

for l in Even:
    if S[l-1] not in Even_right:
        ans='No'

print(ans)

Submission status: Accepted

Solution code:
S = list(input())

for i, j in enumerate(S, 1):
    if i % 2 == 0 and j == 'R':
        print('No')
        exit()
    elif i % 2 != 0 and j == 'L':
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
odd = []
even =[]
flag = "Yes"
for i in range(1,len(s)+1):
    if i % 2 != 0:
        odd.append(s[i-1])
    else:
        even.append(s[i-1])
if "L" in odd:
    flag = "No"
if "R" in even:
    flag = "No"
print(flag)

Submission status: Accepted

Solution code:
S=input()

p=True
q=True
for i in S:
  if p:
    if not i=='L':
      p=False
    else:
      q=False
      break
  else:
    if not i=='R':
      p=True
    else:
      q=False
      break

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

Submission status: Accepted

Solution code:

def solve(S):
    index = 1
    for word in S:
        if index % 2 != 0 and word == 'L':
            return 'No'
        elif index % 2 == 0 and word == 'R':
            return 'No'
        index += 1

    return 'Yes'


S = input()
print(solve(S))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = str(input())

S_odd = S[::2]
S_even = S[1::2]

LinO = 'L' in S_odd
RinE = 'R' in S_even

if LinO == True or RinE == True:
	print('No')
else:
	print('Yes')

Submission status: Accepted

Solution code:
S = list(input())


def dance_checker(S):
    N = len(S)
    for i in range(N):
        if i % 2 == 0:
            if S[i] == "L":
                return("No")
        else:
            if S[i] == "R":
                return("No")

    return("Yes")


print(dance_checker(S))

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 18,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().rstrip()
ans = 'Yes'
for i in range(len(S)):
    if i % 2 == 0 and S[i] == 'L':
        ans = 'No'
        break
    elif i % 2 == 1 and S[i] == 'R':
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
for i, s in enumerate(S):
    # iは0から
    if i % 2 == 0:
        if s == 'L':
            ans = 'No'
            break
    if i % 2 == 1:
        if s == 'R':
            ans = 'No'
            break
else:
    ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
S = input()

if "L" in S[0::2]:
  print("No")
elif "R" in S[1::2]:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
s = input()

if "L" in s[::2] :
    print("No")
elif "R" in s[1::2] :
    print("No")
else :
    print("Yes")