Problem:


Score: 200 points

Problem Statement

Takahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.

S is said to be easily playable if and only if it satisfies both of the following conditions:

Every character in an odd position (1-st, 3-rd, 5-th, \ldots) is R, U, or D.

Every character in an even position (2-nd, 4-th, 6-th, \ldots) is L, U, or D.

Your task is to print Yes if S is easily playable, and No otherwise.

Constraints

S is a string of length between 1 and 100 (inclusive).

Each character of S is L, R, U, or D.

Input

Input is given from Standard Input in the following format:

S

Output

Print Yes if S is easily playable, and No otherwise.

Sample Input 1

RUDLUDR

Sample Output 1

Yes

Every character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.

Every character in an even position (2-nd, 4-th, 6-th) is L, U, or D.

Thus, S is easily playable.

Sample Input 2

DULL

Sample Output 2

No

The 3-rd character is not R, U, nor D, so S is not easily playable.

Sample Input 3

UUUUUUUUUUUUUUU

Sample Output 3

Yes

Sample Input 4

ULURU

Sample Output 4

No

Sample Input 5

RDULULDURURLRDULRLR

Sample Output 5

Yes



Sample input:
RUDLUDR


Sample output:
Yes

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().strip()
flag = True
i = 0
while i < len(s):
  if i % 2:
    if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
      flag = False
      break
  else:
    if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
      flag = False
      break
  i += 1
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

for i in range(0,len(s),2):
        if s[i] == "L":
                print("No")
                exit()

for i in range(1,len(s),2):
        if s[i] == "R":
                print("No")
                exit()

print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = input()
idx = 1
for s in S:
  if idx%2==1:
    if not(s=='R' or s=='U' or s=='D'):
      print('No')
      sys.exit()
    else:
      idx+=1
  else:
    if not(s=='L' or s=='U' or s=='D'):
      print('No')
      sys.exit()
    else:
      idx+=1
print('Yes')

Submission status: Accepted

Solution code:
s = input()
f = True
for i in range(len(s)):
    if i%2 == 0:#iが偶数ならs[i]は奇数番目
        if s[i] == 'L':#奇数番目にL来たらFalse
            f = False
            break
    
    else:
        if s[i] == 'R':
            f = False
            break
if f:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

print(["Yes","No"]["L" in odd or "R" in even])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:



k = ["R","U","D"]
g = ["L","U","D"]
S = list(input())
ans = "Yes"

for n,s in enumerate(S):
    if(n % 2 == 0):
        if((s in k) == False):
            ans = "No"
            break
    else:
        if((s in g) == False):
            ans = "No"
            break
print(ans)

Submission status: Accepted

Solution code:
import sys

s= input()
dic = {0:'R',1:'L'}
for i in range(len(s)):
  if s[i] == dic[(i+1)%2]:
    print('No')
    sys.exit()
    
print('Yes')

Submission status: Accepted

Solution code:
S = input()
k = False
for i, s in enumerate(S):
    if (i+1) % 2 == 0:
        if s == "L" or s == "U" or s == "D":
            k = True
        else:
            k = False
            break
    else:
        if s == "R" or s == "U" or s == "D":
            k = True
        else:
            k = False
            break

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

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 len(s) == count:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:

s = list(input())

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

Submission status: Accepted

Solution code:
s=input()
flg=False

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

Submission status: Accepted

Solution code:
# AtCoder
S = input()
even = set(S[1::2])
odd = set(S[0::2])
ans = 'Yes'

for i in odd:
    if i not in ['R', 'U', 'D']:
        print('No')
        exit()
for i in even:
    if i not in ['L', 'U', 'D']:
        print('No')
        exit()

print(ans)

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


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


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
	S = input()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
b = True
k = 0
for i in range(len(s)):
    k += 1
    if k%2 == 0:
        if s[i] in even:
            continue
        else:
            b = False
            break
    else:
        if s[i] in odd:
            continue
        else:
            b = False
            break

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

Submission status: Accepted

Solution code:
import numpy as np
S = input()
l = len(S)
oddArr = np.arange(1,l+1,2)
evenArr = np.arange(2,l+1,2)
playable = True
for i in oddArr:
    if S[i-1]=='R' or S[i-1]=='U' or S[i-1]=='D':
        continue
    else:
        playable = False
        break
if playable:
    for i in evenArr:
        if S[i-1] == 'L' or S[i-1] == 'U' or S[i-1] == 'D':
            continue
        else:
            playable = False
            break
if playable:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())
if s[0:len(s)+1:2].count("L")>0 or s[1:len(s)+1:2].count("R")>0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
import sys
s = input()

for i, name in enumerate(s):
    if (i + 1) % 2 != 0:
        if name == 'L':
            print('No')
            sys.exit()
    else:
        if name == 'R':
            print('No')
            sys.exit()

print('Yes')

Submission status: Accepted

Solution code:

a = input()

print("No" if any([(i % 2 == 0 and a[i] == 'L') or
                   (i % 2 == 1 and a[i] == 'R') for i in
                   range(len(a))]) else "Yes")

Submission status: Accepted

Solution code:
S = str(input())
od = ['R', 'U', 'D']
nod = ['L', 'U', 'D']

j = True
for i in range(len(S)):
    if i%2 == 0:
        if S[i] not in od:
            print("No")
            exit()
    else:
        if S[i] not in nod:
            print("No")
            exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()
flg = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] == 'L':
    flg = 1
  if i % 2 == 1 and s[i] == 'R':
    flg = 1
if flg == 0:
  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()
    #偶数処理　
    if i%2==1:
        if S[i]=="R":
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
b=list(a)
c=1
x=0
ans={"L":1,"R":0,"U":0,"D":0}
ans2={"L":0,"R":1,"U":0,"D":0}
for i in b:
    if int(c)%2==1:
        x=x+ans[i]
    elif int(c)%2==0:
        x=x+ans2[i]
    c=c+1
if x>=1:
	print("No")
else:
  	print("Yes")

Submission status: Accepted

Solution code:
a=input()
b=list(a)
c=1
x=0
ans={"L":1,"R":0,"U":0,"D":0}
ans2={"L":0,"R":1,"U":0,"D":0}
for i in b:
	if int(c)%2==1:
		x=x+ans[i]
	elif int(c)%2==0:
		x=x+ans2[i]
	c=c+1
if x>=1:
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
n = input()
t = 1
for i in range(len(n)):
    if i%2==0:
        if n[i] == "L":
            t=0
            break
    else:
        if n[i]== "R":
            t = 0
            break
if t ==1:
    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)):
    if (i+1) % 2 == 1:
        if s[i] not in odd:
            print('No')
            exit(0)
    else:
        if s[i] not in even:
            print('No')
            exit(0)

print('Yes')

'''

odd = s[::2]
even = s[1::2]

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    s = input()

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

    ans = True

    for i, ss in enumerate(s):
        if (i + 1) % 2 == 0 and ss in even:
            continue
        elif (i + 1) % 2 == 1 and ss in odd:
            continue
        else:
            ans = False
            break

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """RUDLUDR"""
        output = """Yes"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """DULL"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """UUUUUUUUUUUUUUU"""
        output = """Yes"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """ULURU"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_5(self):
        input = """RDULULDURURLRDULRLR"""
        output = """Yes"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

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

print('Yes')

Submission status: Accepted

Solution code:
s = input()

check = ["L", "R"]

ans = "Yes"
for i, c in enumerate(s):
    if c == check[i % 2]:
        ans = "No"
        break
print(ans)

Submission status: Accepted

Solution code:
s = input()

o = s[::2]
e = s[1::2]

ans = "Yes" if ("L" not in o) and ("R" not in e) else "No" 
print(ans)

Submission status: Accepted

Solution code:
s=input()
l=len(s)

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

Submission status: Accepted

Solution code:
# ABC 141: B – Tap Dance
S = input()
taps_odd = set('RUD')
taps_even = set('LUD')

print('Yes' if len(set(S[::2]) - taps_odd) == 0 and len(set(S[1::2]) - taps_even) == 0 else 'No')

Submission status: Accepted

Solution code:
S = input()

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

if odd.issubset({ 'R', 'U', 'D' }) and even.issubset({ 'L', 'U', 'D' }):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import os

def main():
	s = input()
	count = 0
	flag = True
	for i in s:
		count += 1
		if count%2 == 0:
			if i == "R":
				flag = False
				break
		else:
			if i == "L":
				flag = False
				break
	if flag:
		print("Yes")
	else:
		print("No")	


if __name__ == "__main__":
	main()

Submission status: Accepted

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

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]=='L':
            print(NO)
            return
        if i%2==1 and S[i]=='R':
            print(NO)
            return 
    print(YES)
    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()
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 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

print('Yes')

Submission status: Accepted

Solution code:
# 初期入力
S =input()

#
flag = True

for i,v in enumerate(S):
    if (i+1) %2 ==1 and v in "RUD":
        flag ="Yes"
    elif(i+1) %2 ==1 and v not in "RUD":
        flag ="No"
        break
    if (i+1) %2 ==0 and v in "LUD":
        flag ="Yes"
    elif(i+1) %2 ==0 and v not in "LUD":
        flag ="No"
        break
print(flag)

Submission status: Accepted

Solution code:
s = input()
ret = True
for c in s[::2]:
    if c not in ['R', 'U', 'D']:
        ret =False
for c in s[1::2]:
    if c not in ['L', 'U', 'D']:
        ret =False
if ret:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
od = ["R","U","D"]
ev = ["L","U","D"]
f = True
for i in range(len(s)):
    if i%2==0:
        if s[i]in od:pass
        else: f=False
    if i%2==1:
        if s[i]in ev:pass
        else: f=False
if f: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)):
    if i % 2 == 0 and s[i] not in odd:
        print('No')
        exit()
    elif i % 2 == 1 and s[i] not in even:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
import itertools
##print(ord("A"))
#n = int(input())
#n,k = map(int,input().split())
#h = list(map(int,input().split()))	
s = input()
ok  = "Yes"
for i in range(1,len(s)+1):
    #print(i,s[i-1])
    if i%2 == 0:
        if s[i-1]=="R":
            ok = "No"
    else:
        if s[i-1] == "L":
            ok = "No"

print(ok)

Submission status: Accepted

Solution code:
S=input()
flag=0
for i in range(len(S)):
  now=S[i]
  if i%2==1 and (now=="L" or now=="U" or now=="D"):
    continue
  elif i%2==0 and (now=="R" or now=="U" or now=="D"):
    continue
  else:
    print("No")
    flag=1
    break
if flag==0:
  print("Yes")

Submission status: Accepted

Solution code:
S = input()

cnt =1
okflg = True

for s in S:
    
    if cnt%2==0:
        if s!="L"and  s!="U" and s!="D":
            okflg = False
            break
    else:
        if s!="R" and s!="U" and s!="D":
            okflg = False
            break
            
    cnt = cnt+1

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

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    s=list(input())
    od={"R","U","D"}
    ev={"L","U","D"}
    yn=""
    for i in range(0,len(s),2):
        if not s[i] in od:
            yn="No"
            break
    if yn!="No":
        for i in range(1,len(s),2):
            if not s[i] in ev:
                yn="No"
                break
    if yn=="No":
        print("No")
    else:
        print("Yes")

Submission status: Accepted

Solution code:
S = input()

N=len(S)
flag=1

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

print('Yes' if flag==1 else 'No')

Submission status: Accepted

Solution code:
s = input()
ans = True
for i in s[::2]:
    if i == "L":
        ans = False
for i in s[1::2]:
    if i == "R":
        ans = False
if ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

s=str(input())

for i in range(len(s)):
  if (i+1)%2==1:
    if s[i]=="R" or s[i]=="U" or s[i]=="D":
      continue
    else:
      print("No")
      sys.exit()

  else:
    if s[i]=="L" or s[i]=="U" or s[i]=="D":
      continue
    else:
      print("No")
      sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
def main():
    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 even and odd:
        print("Yes")
    else:
        print("No")
main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
N = len(S)

for i in range(-(-N//2)):
  if S[i*2] == "L":
    print("No")
    exit()
    
for i in range(N//2):
  if S[i*2+1] == "R":
    print("No")
    exit()

    
print("Yes")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
N = len(S)

for i in range(-(-N//2)):
  if S[i*2] == "L":
    print("No")
    exit()
    
for i in range(N//2):
  if S[i*2+1] == "R":
    print("No")
    exit()
    
if N%2 == 1:
  if S[N-1] == "L":
    print("No")
    exit()
    
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

print(output)

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

a = 0
b = 0
ans = 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":
             b += 1

if len(s)%2 == 0:
    if a == (len(s))//2 and b == len(s)//2:
        ans = 1
else:
    if a == (len(s)+1)//2 and b == (len(s)-1)//2:
        ans = 1
if ans ==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
string = str(input())
flag = True
for i in range(len(string)):
	if (i+1)%2==0:
		if( string[i]!='L' and string[i]!='U' and string[i]!='D' ):
			# print(string[i],i)
			flag = False
			break
	else:
		if ( string[i]!='R' and string[i]!='U' and string[i]!='D' ):
			flag = False
			# print(string[i],i)
			break
if(flag):
	print("Yes")
else:
	print("No")

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=list(map(str,input()))
N=len(S)

count=0
for i in range(N):
  if i %2==0:
    if S[i]=="L":
      count+=1
    else:
      count+=0
  if i %2==1:
    if S[i]=="R":
      count+=1
    else:
      count+=0
if count==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  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)
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
def main():
    s = input()
    flag = False
    for i in s[0:len(s):2]:
        if i not in ["R", "U", "D"]:
            flag = True
    for i in s[1:len(s):2]:
        if i not in ["L", "U", "D"]:
            flag = True
    if flag:print("No")
    else:print("Yes")
         

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=input()
s=[str(c) for c in s]
x1=s[0::2]
x2=s[1::2]

l1=len(x1)
l2=len(x2)
k=0
for i in range(l1):
  if x1[i]=="R" or x1[i]=="U" or x1[i]=="D":
    k+=1
for i in range(l2):
  if x2[i]=="L" or x2[i]=="U" or x2[i]=="D":
    k+=1
if k==l1+l2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
print("No" if ("L" in S[0::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()
count = 0

for i, n in enumerate(S):
    if (i + 1) % 2 == 0:
        if n == "L" or n == "U" or n == "D":
            count += 1
    else:
        if n == "R" or n == "U" or n == "D":
            count += 1

if len(S) == count:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

o=S[::2]
e=S[1::2]

if "R" in e or "L" in o:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()
s = list()
for a in S:
    s.append(a)

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

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

Submission status: Accepted

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

s = input()
print(Inn(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(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 = list(input())
for i in range(len(s)):
  if i%2==0 and s[i]=='L':
    print('No')
    exit()
  if i%2!=0 and s[i]=='R':
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
S = input()
Kisuuretu = S[::2]
Guusuuretu = S[1::2]
if Kisuuretu.count("L") == 0 and Guusuuretu.count("R") == 0:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution
import io
# libraries

data = input()

nim = len(data)

l = 0

for i in range(nim):
    if i%2==0:
        if data[i]=="L":
            l=1
    else:
        if data[i]=="R":
            l=1

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

Submission status: Accepted

Solution code:
S=input()
is_true=True
for i in range(0,len(S),2):
    
    if S[i]!="R" and S[i]!="U" and S[i]!="D":
        is_true=False
        break
for i in range(1,len(S),2):
    
    if S[i]!="L" and S[i]!="U" and S[i]!="D":
        is_true=False
        break
print("Yes" if is_true==True else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
o = [s[2 * i] for i in range((len(s) + 1)// 2)]
e = [s[2 * i + 1] for i in range(len(s) // 2)]
if "L" not in o and "R" not in e:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#from sys import stdin
#import math
#from functools import reduce
    
#A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
#N = int(input())
S = list(input())
 
is_difficult = 'Yes'

for i, s in enumerate(S):
    if (i+1)%2 == 0:
        if (s=='R'):
            is_difficult = 'No'
            break
    else:
        if (s=='L'):
            is_difficult = 'No'
            break
print(is_difficult)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = 'Yes'
for i in range(n):
    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 = input()
steppable = True

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

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

Submission status: Accepted

Solution code:
S = input()
n = len(S)
NG = 0
for i in range(n):
  tmp = S[i]
  if (tmp == "U" or tmp == "D"):
    pass
  else:
    if(i % 2 == 0):
      if(tmp == "R"):
        pass
      else:
        NG += 1
    else:
      if(tmp == "L"):
        pass
      else:
        NG += 1
if (NG == 0):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=list(input())

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