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:
# coding: utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*D, = [s.split() for s in open(0)]
D = D[0][0]
flag = 0
for i in range(len(D)):
    if (i + 1) % 2 == 0:
        if not D[i] in ["L", "U", "D"]:
            flag += 1
            break
    else:
        if not D[i] in ["R", "U", "D"]:
            flag += 1
            break
if flag:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = str(input())

n = len(s)
a = True
odd = ['R','U','D']
even = ['L','U','D']

m = n // 2
if n == 1:
    if s in odd:
        print('Yes')
    else:
        print('No')
else:
    if all((s[2 * i] in odd) for i in range(m)):
        if all(((s[2 * i + 1]) in even) for i in range(m)):
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

S = list(str(input()))
O = ['R', 'U', 'D']
E = ['L', 'U', 'D']

for i in range(len(S)):
    if (i + 1) % 2 != 0:
        if O.count(S[i]) == 0:
            print('No')
            break
    else:
        if E.count(S[i]) == 0:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
flg=0
i=0

while i<len(s):
	if (i%2==0 and s[i]=="L") or i%2!=0 and s[i]=="R":
		flg=1
		break
	i+=1
	
if flg==0:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
S = input()

Slis = list(S)

SLEN = len(Slis)

ans = 0

for i in range(SLEN):
    if i % 2 == 0 and (Slis[i] == "R" or Slis[i] == "U" or Slis[i] == "D"):
        continue
    elif i % 2  == 1 and (Slis[i] == "L" or Slis[i] == "U" or Slis[i] == "D"):
        continue
    else:
        ans = ans + 1

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

Submission status: Accepted

Solution code:
S=input()
print(("Yes","No")["L" in S[::2] or "R" in S[1::2]])

Submission status: Accepted

Solution code:
S=input()
print(("Yes","No")[S[::2].find("L")>=0 or S[1::2].find("R")>=0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

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

Submission status: Accepted

Solution code:
S=input()

count_even=0
count_odd=0

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

for i in range(len(S)):
    if (i+1)%2==0:
        if(S[i] in even):
            count_even+=1
    else:
        if(S[i] in odd):
            count_odd+=1

if(count_odd + count_even == len(S)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

flg = 0
for i in range(len(S)):
    if i % 2 == 1:
        if not S[i] in even:
            flg = 1
    else:
        if not S[i] in odd:
            flg = 1

print("Yes" if flg ==0 else "No")

Submission status: Accepted

Solution code:
# ABC-141-B
S = list(input())
S.insert(0, None)
ans = "Yes"

for i in range(1, len(S)):
    if i % 2 == 1:
        if S[i] == "L":
            ans = "No"
            break
    else:
        if S[i] == "R":
            ans = "No"
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

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

flag = "Yes"

for i in range(len(S)):
    if i % 2:
        if S[i] not in even:
            flag = "No"
            break
    else:
        if S[i] not in odd:
            flag = "No"
            break
print(flag)

Submission status: Accepted

Solution code:
import sys

alf = list(str(input()))
for index1 in range(0,len(alf),2):
	if alf[index1]=="L":
		print("No")
		sys.exit()
for index1 in range(1,len(alf),2):
	if alf[index1]=="R":
		print("No")
		sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
flag = True
cnt = 1
for i in S:
    if cnt % 2 != 0:
        if i != "R" and i != "U" and i != "D":
            flag = False
            break
    else:
        if i != "L" and i != "U" and i != "D":
            flag = False
            break
    cnt += 1
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# 16:20
s = input()
for i in range(len(s)):
    if s[i] != 'U' and s[i] != 'D':
        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()
n=len(s)
ans="Yes"
for i in range(1,len(s)+1):
    if i%2==0:
        if s[i-1]=='R':
            ans="No"
    elif i%2==1:
        if s[i-1]=='L':
            ans="No"
print(ans)

Submission status: Accepted

Solution code:
s=input()
for i in range(len(s)):
  if ((i%2 and s[i]=="R")
     or (not i%2 and s[i]=="L")):
    print("No")
    break
  elif i == len(s)-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":
        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:
#!/usr/bin/env python3
import sys

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


def solve(S: str):
    odd = ""
    even = ""
    for i in range(len(S)):
        if i % 2 == 0:
            odd += S[i]
        else:
            even += S[i]
    alloddok = "L" not in odd
    allevenok = "R" not in even
    if allevenok and alloddok:
        print(YES)
    else:
        print(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()

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

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

Submission status: Accepted

Solution code:
S=list(input())
flag = True
for i in range(len(S)):
  s = S[i]
  if (i+1)%2==0:
    if s=="R":
      flag = False
  else:
    if s=="L":
      flag = False

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

Submission status: Accepted

Solution code:
a=input()
b=set(a[::2])
c=set(a[1::2])
b=b-{'R', 'U', 'D'}
c=c-{'L', 'U', 'D'}
if b==set() and c==set():
  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
    else:
        if S[i]=='R':
            cnt+=1
if cnt==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()

odd='R'
even='L'

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

Submission status: Accepted

Solution code:
def main():
    S = str(input())

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)):
    #print(i)
    #print(s[i])
    if (i + 1) % 2 == 0 and s[i] not in 'LUD':
        print('No')
        exit()
    if (i + 1) % 2 == 1 and s[i] not in 'RUD':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

good_o = ['R', 'U', 'D']
good_e = ['L', 'U', 'D']

ans = 'No'
for i, Si in enumerate(S):
    if i % 2 == 0:
        if Si not in good_o: break
    else:
        if Si not in good_e: break
else:
    ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

flag = True

for i in range(len(s)):
    if i % 2 == 0:
        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:
import re

s = [i for i in input()]
flg = True
for i in range(len(s)):
  if i % 2 == 0 and re.match(r'L',s[i]):
    flg = False
  elif i % 2 != 0 and re.match(r'R',s[i]):
    flg = False
print("Yes" if flg else "No")

Submission status: Accepted

Solution code:
N=list(input())
a=[]
b=[]
#print(N)
#print(len(N))
for k in range(len(N)):
    if k%2>0:
        b.append(N[k])
    else:
        a.append(N[k])
if   a.count('L')==0 and b.count('R')==0:
    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] == "L":
            print("No")
            sys.exit()
    else:
        if S[i] == "R":
            print("No")
            sys.exit()
            
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

EVEN = 'L'
ODD = 'R'

L = list(S)
for i in range(len(L)):
    if L[i] in ['U', 'D']:
        continue
    if (i + 1) % 2 == 0:
        if L[i] != EVEN:
            print("No")
            exit()
    else:
        if L[i] != ODD:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)):
    if ((i+1)%2 != 0 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()

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

print("Yes")

Submission status: Accepted

Solution code:
s = list(input())

flg = 0

for i in range(len(s)):
    if i % 2 ==1:
        if str(s[i]) == "R":
            flg = 1
    else:
        if str(s[i]) == "L":
            flg = 1

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

Submission status: Accepted

Solution code:
s=input()
side='R'
flag=True
for x in s:
  if x==side or x in ('U','D'):
    side='L' if side=='R' else 'R'
    continue
  else:
    flag=False
print('Yes' if flag else 'No')

Submission status: Accepted

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=list(input())
a=1
for i in n:
    if not ((a%2==1 and (i=="R" or i == "U" or i == "D")) or (a%2==0 and (i=="L" or i == "U" or i == "D"))):
        print("No")
        exit()
    a+=1
print("Yes")

Submission status: Accepted

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

S = input()

ans = "No"
# 文字
for i in range(len(S)):
    # 奇数
    if i % 2 == 0 and (S[i] == "R"  or S[i] == "U"  or S[i] == "D" ):
       ans = "Yes"
    # 偶数
    elif i % 2 != 0 and (S[i] == "L"  or S[i] == "U"  or S[i] == "D" ):
       ans = "Yes"
    else:
       ans = "No"
       break

print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input()
    s_odd = [S[i] for i in range(0, len(S), 2)]  # 奇数文字目のみを格納
    s_even = [S[i] for i in range(1, len(S), 2)]  # 偶数文字目のみを格納
    if "R" in s_even: print("No"); return
    if "L" in s_odd: print("No"); return
    print("Yes")
 
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    s_even = [S[i] for i in range(0, len(S), 2)]  # 偶数文字目のみを格納
    s_odd = [S[i] for i in range(1, len(S), 2)]  # 奇数文字目のみを格納
    if "L" in s_even: print("No"); return
    if "R" in s_odd: print("No"); return
    print("Yes")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

def main():
    S = input()
    for i in range(len(S)):
        # 確認するべき文字は `R` と `L` のみ
        # 変数 i は０から始まることに留意
        if ((i+1) % 2) == 0:
            # 偶数文字目
            if S[i] == "R":
                print("No")  # RだったらNoが確定する
                return  # 処理終了
        else:
            # 奇数文字目
            if S[i] == "L":
                print("No")  # LだったらNoが確定する
                return  # 処理終了
    print("Yes")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:
S=input()
flag=1#Yes
for i in range(len(S)):
  if (i+1)%2==0:
    if S[i] != "L" and S[i] != "U" and S[i] != "D":
      flag=0
  elif (i+1)%2==1:
    if S[i] != "R" and S[i] != "U" and S[i] != "D":
      flag=0

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

Submission status: Accepted

Solution code:
S = input().strip()
for i,c in enumerate(S):
  if (i % 2 == 0 and c == 'L') or (i % 2 == 1 and c == 'R'):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
Even = ["L","U","D"]
Odd = ["R", "U", "D"]
for i in range(len(S)):
  if (i+1) % 2 == 0 and S[i] not in Even:
    print("No")
    exit()
  elif (i+1) % 2 != 0 and S[i] not in Odd:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()

e=0
for x in range(0, len(s)):
  if x%2==0 and s[x] == 'L':
    e = 1

o=0
for y in range(0, len(s)):
  if y%2!=0 and s[y] == 'R':
    o = 1
    
if e==1 or o==1:
  print('No')

else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S = list(map(str, input()))

for x in range(0, len(S), 2):
    if(S[x]=='L'):
        print('No')
        sys.exit()

for y in range(1, len(S), 2):
    if(S[y]=='R'):
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(N):
    if i % 2 == 0:
        if not S[i] in 'RUD':
            print('No')
            exit()
    else:
        if not S[i] in 'LUD':
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

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

def stringDevider(S):    
    odd_letters = [S[l] for l in range(len(S)) if l % 2 == 0] 
    even_letters = [S[l] for l in range(len(S)) if l % 2 == 1] 
    
    return odd_letters, even_letters

odd_letters, even_letters = stringDevider(S)

if 'L' not in odd_letters and 'R' not in even_letters:
    print('Yes')
else :
    print('No')

Submission status: Accepted

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

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()

flag = 1

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

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

Submission status: Accepted

Solution code:
S=list(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()
    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()
count=0
for i in range(1,len(S)+1):
  if i%2==0:
      if S[i-1]=='R':
        count+=1
  else:
      if S[i-1]=='L':
          count+=1
if count==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()

s = list(s)

test = 0

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

print('Yes' if test == 0 else 'No')

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

answer = "Yes"

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

Submission status: Accepted

Solution code:
li=list(str(input()))
cnt=1
for l in li:
  if(cnt%2==0):
    if(l=="L" or l=="U" or l=="D"):
      cnt+=1
    else:
      print("No")
      break
  else:
    if(l=="R" or l=="U" or l=="D"):
      cnt+=1
    else:
      print("No")
      break
if(cnt==len(li)+1):
  print("Yes")

Submission status: Accepted

Solution code:
def check():
    S = input()
    a = 1
    
    for s in S:
        if a % 2 == 0:
            if s == 'R':
                return 'No'
        else:
            if s == 'L':
                return 'No'
        a += 1
    return 'Yes'
  
print(check())

Submission status: Accepted

Solution code:
S=input()
j=0
refO=set(["R","U","D"])
refE=set(["L","U","D"])
for i in range(len(S)):
  if i%2==1 and (S[i] in refE):
    j+=1
  elif i%2==0 and (S[i] in refO):
    j+=1
  else:
    break
if j==len(S):
  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:
import numpy as np
S = input()
result = ["No", "Yes"]
print(result[np.array([s in list("RUD") if i%2==0 else s in list("LUD") for i, s in enumerate(S)]).all().astype(int)])

Submission status: Accepted

Solution code:
ok = True
a= input()
for i in range(len(a)):
  if i % 2 == 0:
    if a[i] not in 'RUD':
      ok = False
  else:
    if a[i] not in 'LUD':
      ok = False

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
#input = sys.stdin.readline

easy = True
S = input()
for i in range(len(S)):
	#print(i, S[i])
	if not i%2 and S[i] in 'RUD':
		continue
	if i%2 and S[i] in 'LUD':
		continue
	easy = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = input()
ODD =['R', 'U', 'D']
EVEN =['L', 'U', 'D']
Result = True
for i in range(len(A)):
  if i % 2 ==0:
    Result = Result and (A[i] in ODD)
  else:
    Result = Result and (A[i] in EVEN)
if Result:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t={'R','L','U','D'}
s_odd=''.join(x for i,x in enumerate(s) if i%2==0)
s_even=''.join(x for i,x in enumerate(s) if i%2!=0)
print('No' if len(set(s)-t) or 'L' in s_odd or 'R' in s_even else 'Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

for x in S[0::2]:
    if x == 'L':
        print('No')
        exit()

for y in S[1::2]:
    if y == 'R':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
S = list(input())

A = []

for x in S[0::2]:
    if x in ['R', 'U', 'D']:
        A.append('Yes')
    else:
        A.append('No')

for y in S[1::2]:
    if y in ['L', 'U', 'D']:
        A.append('Yes')
    else:
        A.append('No')

# print(A)

if 'No' not in A:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def no():
    print("No")
def yes():
    print("Yes")

s=input().rstrip()
len=len(s)
#print(len)
for i in range(0,len):
    if i%2==0:
        if(s[i]=="L"):
            no()
            exit()
    else:
        if(s[i]=="R"):
            no()
            exit()
yes()

Submission status: Accepted

Solution code:
def no():
    print("No")
def yes():
    print("Yes")

s=input().rstrip()
len=len(s)
#print(len)
for i in range(0,len):
    if i%2==0:
        if(s[i]=='L'):
            no()
            exit()
    else:
        if(s[i]=='R'):
            no()
            exit()
yes()

Submission status: Accepted

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

A = []

for x in range(len(S)):
    if x % 2 == 0:
        if S[x] in ['R', 'U', 'D']:
            A.append('Yes')
        else:
            A.append('No')
    elif x % 2 == 1:
        if S[x] in ['L', 'U', 'D']:
            A.append('Yes')
        else:
            A.append('No')

# print(A)

if 'No' not in A:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

print("YNeos"[not(s[0::2].find('L')==-1 and s[1::2].find('R')==-1)::2])

Submission status: Accepted

Solution code:
s = input()
s_odd = s[0::2]
s_even = s[1::2]

print("YNeos"[not(s_odd.find('L')==-1 and s_even.find('R')==-1)::2])

Submission status: Accepted

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

_s = input()[:-1]


def chker(s):
    rs = s[::2]
    ls = s[1::2]

    if 'L' in rs:
        print('No')
        return

    if 'R' in ls:
        print('No')
        return

    print('Yes')


chker(_s)

Submission status: Accepted

Solution code:
s = input()

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

# print(o, e)

if 'L' in o:
    print('No')
    exit()

if 'R' in e:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()
list_s = list(s)
odd_list = ['R','U','D']
even_list= ['L','U','D']
identifier = [] 
for i in range(1,len(list_s)+1):
    if s[i-1] in even_list and i % 2 == 0: 
            identifier.append(1) 
    if i % 2 != 0 and s[i-1]in odd_list:
            identifier.append(1)
if identifier == [1]*len(list_s):
    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]=="R" or S[i]=="U" or S[i]=="D":
            pass
        else:
            flag = False
            break
    else:
        if S[i]=="L" or S[i]=="U" or S[i]=="D":
            pass
        else:
            flag = False
            break

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
for i in range(n):
    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 = str(input())
for i in range(1, len(S), 2):
    if S[i] == "L" or S[i] == "U" or S[i] == "D":
        continue
    else:
        print("No")
        exit()
for i in range(0, len(S), 2):
    if S[i] == "R" or S[i] == "U" or S[i] == "D":
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
import numpy

S = input()
isContinue = True

for i in range(0, len(S), 2):
    if isContinue and S[i] not in ['R', 'U', 'D']:
        print('No')
        isContinue = False

for i in range(1, len(S), 2):
    if isContinue and S[i] not in ['L', 'U', 'D']:
        print('No')
        isContinue = False

if isContinue:
    print('Yes')

Submission status: Accepted

Solution code:
S = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
chk = 0
for i in range(1, len(S)+1):
  if i % 2 != 0 and S[i-1] in odd:
    chk = chk + 1
  if i % 2 == 0 and S[i-1] in even:
    chk = chk + 1
    
if chk == len(S):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = list(input())
odd_easy_steps = ["R", "U", "D"]
event_easy_steps = ["L", "U", "D"]
is_easy_step = True
for i, s in enumerate(S):
    index = i + 1
    if index % 2 == 0 and s not in event_easy_steps:
        is_easy_step = False
        break
    elif index % 2 != 0 and s not in odd_easy_steps:
        is_easy_step = False
        break
print("Yes" if is_easy_step else "No")

Submission status: Accepted

Solution code:
odd_steps = ['R', 'U', 'D']
even_steps = ['L', 'U', 'D']

S = input()

flg = True
for i in range(len(S)):
    if (i + 1) % 2 == 1 and S[i] not in odd_steps:
        flg = False
        break

    if (i + 1) % 2 == 0 and S[i] not in even_steps:
        flg = False
        break

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