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

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

o = set(S_odd).issubset(set(["R","U", "D"])) 
e = set(S_even).issubset(set(["L","U", "D"]))
if o + e == 2:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
#print(n)
k,g=[],[]
for i in range(n):
    if i%2==0:
        k.append(s[i])
    else:
        g.append(s[i])
#print(k)
#print(g)
for j in k:
    if j == 'L':
        print('No')
        break

else:
    for l in g:
        if l == 'R':
            print('No')
            break
    else:
        print('Yes')

Submission status: Accepted

Solution code:
S = input()
if len(S[::2].replace('R','').replace('U','').replace('D','')) + len(S[1::2].replace('L','').replace('U','').replace('D',''))==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
s_odd = []
s_even = []

for i in range(len(s)):
  if i % 2 == 0:
    s_even.append(s[i])
  else:
    s_odd.append(s[i])

ans_bool = True

if "L" in s_even:
  print("No")
elif "R" in s_odd:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc141/tasks/abc141_b

c = input()

ans = "Yes"
odd = ['R','U','D']
eval = ['L','U','D']
for i in range(len(c)):
    if i % 2 == 0 and not c[i] in odd:
        ans = "No"
    elif i % 2 == 1 and not c[i] in eval:
        ans = "No"
print(ans)

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()
ok = 1

for i in range(1,len(S)+1):
  if i%2!=0 and S[i-1]=='L':ok=0
  if i%2==0 and S[i-1]=='R':ok=0
    
if ok:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    s = S()
    n = len(s)
    f = True
    for i in range(0,n,2):
        if s[i] == "L":
            f = False
            break
    for i in range(1,n,2):
        if s[i] == "R":
            f = False
    if f:
        return 'Yes'

    return "No"


print(main())

Submission status: Accepted

Solution code:
s = input()

even = []
odd = []
for i, elem in enumerate(s):
  if i % 2 == 0:
    odd.append(elem)
  else:
    even.append(elem)

if all(elem in ['D', 'U', 'L'] for elem in list(set(even))) and all(elem in ['U', 'R', 'D'] for elem in list(set(odd))):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = str(input())
odd = "RUD"
even = "LUD"
flag = True

for i in range(len(s)):
 if i%2 == 0 and s[i] not in odd:
  flag = False
 elif i%2 != 0 and s[i] not in even:
  flag = False

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

Submission status: Accepted

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

def main():
    s = list(input())
    gusu_count = 0
    kisu_count = 0
    
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
                kisu_count += 1
                
        else:
            if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
                gusu_count += 1
                
    if len(s) % 2 != 0:
        if gusu_count == len(s) // 2 and kisu_count == ((len(s) // 2 ) + 1):
            print('Yes')
    
        else:
            print('No')
            
    else:
        if gusu_count == len(s) // 2 and kisu_count == (len(s) // 2):
            print('Yes')
            
        else:
            print('No')
    
    return 0
    
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
import numpy as np


def main():
    
    taps = list(input())
    
    for i, tap in enumerate(taps):
        if i % 2 == 0 and tap in ('R', 'U', 'D'):
            pass
        elif i % 2 == 1 and tap in ('L', 'U', 'D'):
            pass
        else:
            print('No')
            return 0
    print('Yes')
    
    return 0
    
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()


def is_OK(S):
    i = 1
    for s in S:
        if i % 2 != 0:
            if s not in ['R', 'U', 'D']:
                return False
        elif i % 2 == 0:
            if s not in ['L', 'U', 'D']:
                return False
        i += 1
    return True


if is_OK(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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()

RUD = {'R','U','D'}
LUD = {'L','U','D'}

if set(s[::2])<=RUD and set(s[1::2]) <=LUD:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
if len(s)%2==0:
    for i in range(len(s)//2):
        if s[2*i]=="L" or s[2*i+1]=="R":
            ans += 1
elif len(s)%2!=0:
    for i in range(len(s)//2):
        if s[2*i]=="L":
            ans += 1
        elif s[2*i+1]=="R":
            ans += 1
    if s[-1]=="L":
        ans += 1

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

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
if len(s)%2==0:
    for i in range(len(s)//2):
        if s[2*i]=="L" or s[2*i+1]=="R":
            ans += 1
            break
elif len(s)%2!=0:
    for i in range(len(s)//2):
        if s[2*i]=="L":
            ans += 1
            break
        elif s[2*i+1]=="R":
            ans += 1
            break
    if s[-1]=="L":
        ans += 1

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

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
if len(s)%2==0:
    for i in range(len(s)//2):
        if s[2*i]=="L" or s[2*i+1]=="R":
            ans += 1
            break
        else:
            continue
elif len(s)%2!=0:
    for i in range(len(s)//2):
        if s[2*i]=="L":
            ans += 1
            break
        elif s[2*i+1]=="R":
            ans += 1
            break
        else:
            continue
    if s[-1]=="L":
        ans += 1

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

Submission status: Accepted

Solution code:
s =input()
x=["L","R"]

ans="Yes"
for i in range(len(s)):
    if s[i]==x[i%2]:
        ans="No"
        break
print(ans)

Submission status: Accepted

Solution code:
s = input()

OD = {"D", "R", "U"}
EV = {"D", "L", "U"}

if ((set(s[::2])) <= OD) and ((set(s[1::2])) <= EV):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()
check=1
flag=0
for i in s:
    #print(i)
    if check ==1:
        if i == "R" or i == "U" or i=="D":
            check=0
            continue
        else:
            flag=1
    else:
        if i == "L" or i == "U" or i=="D":
            check=1
            continue
        else:
            flag=1

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

Submission status: Accepted

Solution code:
# Tap Dance

# input
S = input()

# solve
cond1 = sum([s == 'L' for s in S[::2]])
cond2 = sum([s == 'R' for s in S[1::2]])

# output
if cond1 == 0 and cond2 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
text = input()

if all(text[i * 2] != "L" for i in range((len(text) + 1) // 2)) and \
   all(text[i * 2 + 1] != "R" for i in range(len(text) // 2)):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ans = "Yes"
for i in range(0,len(S),2):
	if not(S[i] == "R" or S[i] == "U" or S[i] == "D"):
		ans = "No"
		break
	if(i < len(S)-1):
		if not(S[i+1] == "L" or S[i+1] == "U" or S[i+1] == "D"):
			ans = "No"
			break
print(ans)

Submission status: Accepted

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

S_odd = []
S_even = []

for i in range(0, length, 2):
    S_odd.append(S[i])

for i in range(1, length, 2):
    S_even.append(S[i])


if ("L" in S_odd) or ("R" in S_even):
    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 S[i]=="L":
         flag=False
   else:
      if S[i]=="R":
         flag=False

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

Submission status: Accepted

Solution code:
s = input()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
S = input()
easy = True

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
s1 = S[1::2]
s2 = S[::2]


if "L" in s2 or "R" in s1:
    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 s[i] == "L":
            flag = False
    else:
        if s[i] == "R":
            flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A = list(input())
import math
B = []
C = []
count = 0
for i in range(math.ceil(len(A) / 2)):
    B.append(A[count])
    count += 2
count = 1
for i in range(math.floor(len(A) / 2)):
    C.append(A[count])
    count += 2
if "L" not in B and "R" not in C:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
	# n,k = map(int,input().split())
	# n = int(input())
	s = str(input())
	# a = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	s = list(s)
	ans = 0
	for i in range(len(s)):
		# print(s[i])
		# print(len(s[i]) % 2)
		if i % 2 == 0:
			if s[i] == 'L':
				ans = 1
		else:
			if s[i] == 'R':
				ans = 1
	if ans == 0:
		print("Yes")
	else:
		print("No")





if __name__ == '__main__':
	main()

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

Submission status: Accepted

Solution code:
import sys


S = input()

for i, s in enumerate(S):
  if i % 2:
    if s == 'R':
      print("No")
      sys.exit()
  else:
    if s == 'L':
      print("No")
      sys.exit()
      
print("Yes")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32

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

def solve(S: str):
    if all([S[i-1] != 'R' if i%2 == 0 else S[i-1] != 'L' for i in range(1, len(S)+1)]):
        print(YES)
    else:
        print(NO)
    return



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=str(input())
out=["Yes","No"]
flg=0

for i in range(len(S)):
    if i%2==0:
        if S[i]!="R" and S[i]!="U" and S[i]!="D":
            flg=1
            break
    if i%2==1:
        if S[i]!="L" and S[i]!="U" and S[i]!="D":
            flg=1
            break

print(out[flg])

Submission status: Accepted

Solution code:
S = input()
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":
            count+=1
    else:
        if S[i]=="R" 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()
kisuu={'R','U','D'}
guusuu={'L','U','D'}

res = True

# print(S[::2])
for c in S[::2]:
    res = res and c in kisuu

# print(S[1::2])
for c in S[1::2]:
    res = res and c in guusuu

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

Submission status: Accepted

Solution code:
S = input()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
d = {}
d[0] = ["R", "U", "D"]
d[1] = ["L", "U", "D"]
res = True
for i in range(len(s)):
    if s[i] not in d[i%2]:
        res = False

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

Submission status: Accepted

Solution code:
s=input()
od=s[::2]
ev=s[1::2]
if od.count('L')+ev.count('R')==0:
    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")
        exit()
    elif i % 2 == 1 and S[i] == "R":
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
c=1
a=set()
b=set()
for i in input():
    if c%2==0:
        b.add(i)
    else:
        a.add(i)
    c+=1
if 'R' not in b and "L" not in a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in range(0, N, 2):
  if not (S[i] in odd):
    ans += 1
for i in range(1, N, 2):
  if not(S[i] in even):
    ans += 1
 
if ans == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()

def is_easy_to_tap(s):
    for i, c in enumerate(s):
        if((i % 2 == 0) and (c == 'L')):
            return 'No'
        if((i % 2 != 0) and (c == 'R')):
            return 'No'
    return 'Yes'

print(is_easy_to_tap(s))

Submission status: Accepted

Solution code:
S = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
rslt = 'Yes'
for idx, s in enumerate(S):
    if idx%2==1 and s in even:
        continue
    elif idx%2==0 and s in odd:
        continue
    else:
        rslt = 'No'
        break
print(rslt)

Submission status: Accepted

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

b = True

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

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

Submission status: Accepted

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

for i in range(0, len(S), 2):
    if S[i] not in odd:
        flg = False

for i in range(1, len(S), 2):
    if S[i] not in even:
        flg = False

print('Yes') if flg == True else print('No')

Submission status: Accepted

Solution code:
import re


def main(s: str):
    if re.match(r'^([^L][^R])*[^L]?$', s):
        print('Yes')
    else:
        print('No')


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

    main(s)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
S = str(input())
ans = 0
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()
    else:
        if S[i] !='L' and S[i] !='U' and S[i] !='D':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()

for i in range(1, len(s) + 1):
    if i % 2:
        if s[i - 1] not in ["R", "U", "D"]:
            print("No")
            exit()
    else:
        if s[i - 1] not in ["L", "U", "D"]:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
a = 0
for i in range(0,n):
    if (i % 2)== 1:
        if s[i] == 'R':
            a = 1

    else:
        if s[i] == 'L':
            a = 1


if a == 1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

def func(s):
    for i in range(0, len(s), 2):
        if s[i] not in "RUD":
            return "No"

    for i in range(1, len(s), 2):
        if s[i] not in "LUD":
            return "No"

    return "Yes"

print(func(s))

Submission status: Accepted

Solution code:
s = input()

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

c = 0

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

            
    
if len(s) == c:
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())

flg = 0

for i in range(len(s)):
    #偶数
    if i%2 == 0 and s[i] == "L":
        flg = 1
    #奇数        
    elif i%2 ==1 and s[i] == "R":
        flg = 1


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

Submission status: Accepted

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

flag = 'Yes'
for i,s in enumerate(S):
    if i%2==0:
        if s == "L":
            flag='No'
    else:
        if s == "R":
            flag='No'
print(flag)

Submission status: Accepted

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

for i in range(len(s)):
    if i%2==0 and s[i] in odd:
        tmp += 1
    elif i%2!=0 and s[i] in even:
        tmp += 1

print('Yes' if tmp==len(s) else 'No')

Submission status: Accepted

Solution code:
input_tap = input()
flag = 'No'
input_tap1 = input_tap[0::2]
input_tap2 = input_tap[1::2]

if 'L' in input_tap1:
    flag = 'No'
elif 'R' in input_tap2:
    flag = 'No'
else:
    flag = 'Yes'
print(flag)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if "L" in s1:
    print("No")
elif "R" in s2:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = list(input())
li_even = ["L", "U", "D"]
li_odd = ["R", "U", "D"]
flag = True

for i in range(1, len(li)+1):
    if i%2 == 0: 
        if li[i-1] not in li_even:
            flag = False
            break
    else: 
        if li[i-1] not in li_odd:
            flag = False
            break
            
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
h = int(l/2)

if l % 2 ==0:
  for i in range(h):
    if s[2*i] == 'L' or s[2*i + 1] == 'R':
      print('No')
      break
  else:
    print('Yes')

else:
  for i in range(h):
    if s[2*i] == 'L' or s[2*i + 1] == 'R':
      print('No')
      break
  else:
    if s[l-1] == 'L':
      print('No')
    else:
      print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

check_odd = ["R", "U", "D"]
check_even = ["L", "U", "D"]


def Odd():
    for i in S[0::2]:
        if i not in check_odd:
            return True
            break


def Even():
    for j in S[1::2]:
        if j not in check_even:
            return True
            break


if Odd() or Even():
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys

a = input()
l = True

for i in range(len(a)):
    if i % 2 == 1:
        if a[i] == 'R':
            l = False

    if i % 2 == 0:
        if a[i] == 'L':
            l = False

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

Submission status: Accepted

Solution code:
from sys import stdin

char = stdin.readline().rstrip()

for i,c in enumerate(char):
    if i %2 ==0:
        if c not in ("R",'U','D'):
            print('No')
            break
    else:
        if c not in ("L",'U','D'):
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

count = 0

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

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

Submission status: Accepted

Solution code:
s = input()

maybe = True

def ok1(c):
    if c == 'R' or c == 'U' or c == 'D':
        return True
    return False

def ok2(c):
    if c == 'L' or c == 'U' or c == 'D':
        return True
    return False


for i in range(0 , len(s) , 2):
    if not ok1(s[i]):
        maybe = False

for i in range(1 , len(s), 2):
    if not ok2(s[i]):
        maybe = False
#print(s)
#for i in range(0 , len(s) , 2):
#    print(s[i] , end=' ')

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    S=input()
    for i,s in enumerate(S,1):
        if(i&1 and s=='L'):
            print("No")
            return
        if(i&1==0 and s=='R'):
            print("No")
            return
    print("Yes")
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

can = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC141-B Tap Dance
S = list(input())
def oddschange(s):
    if s == 'L':
        return 0
    else:
        return 1
def evenchange(s):
    if s == 'R':
        return 0
    else:
        return 1
ans = 1
for i,s in enumerate(S):
    if i %2 == 0:
        ans *= oddschange(s)
    else:
        ans *= evenchange(s)
print('Yes') if ans else print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
flag = True
for i in range(N//2):
  if S[2*i] == 'L':
    flag = False
  if S[2*i+1] == 'R':
    flag = False
    
if N%2 == 1 and S[N-1] =='L':
    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
    break
  if i%2 == 1 and S[i] == 'R':
    flg = False
    break
    
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
a = input()
if len(a)==1 and a == "L":
    print("No")
    exit()
elif len(a)==1:
    print("Yes")
    exit()
for i in a[::2]:
    for j in a[1::2]:
        if i =="L" or j =="R":
            print("No")
            exit()
else:
    print("Yes")

Submission status: Accepted

Solution code:
s=list(input())
#print(s)
odd = [s[i] for i in range(0, len(s), 2)]
even = [s[i] for i in range(1, len(s), 2)]
#print(odd,even)

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

Submission status: Accepted

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

Submission status: Accepted

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