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 = str(input())
 
cnt = 0
for i in range(0, len(s)):

    if i % 2 == 0:
        if s[i] == "L":
            cnt = 1
            break

    else:
        if s[i] == "R":
            cnt = 1
            break

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

Submission status: Accepted

Solution code:
S = input()
flag = True
for i in range(len(S)):
    s = S[i]
    # print(i+1 % 2)
    if (i+1) % 2 == 1:
        if not(s == "R" or s == "U" or s == "D"):
            flag = False
            break
    elif (i+1) % 2 == 0:
        if not(s == "L" or s == "U" or s == "D"):
            flag = False
            break

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

Submission status: Accepted

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

# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    ret = 'Yes'
    S = str(input())
    for i in range(len(S)):
        if i%2 == 0: #odd
            if S[i] not in ['R', 'U', 'D']:
                ret = 'No'
                break
        else: #even
            if S[i] not in ['L', 'U', 'D']:
                ret = 'No'
                break
    print(ret)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

ans = "Yes"

for i in range(0, len(S_even)):
    if S_even[i] == "R":
        ans = "No"

for i in range(0, len(S_odd)):
    if S_odd[i] == "L":
        ans = "No"
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

print('Yes')

Submission status: Accepted

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

if err_flg:
    print('{}'.format('No'))
else:
    print('{}'.format('Yes'))

Submission status: Accepted

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

import sys, os

def main():
    ans = "Yes"
    steps = list(input())
    for i, st in enumerate(steps):
        if (i%2 == 1):
            if st == "R":
                ans = "No"
        else:
            if st == "L":
                ans = "No"
    print(ans)    
if __name__ == "__main__" :
    main()

Submission status: Accepted

Solution code:
s=input()
N=len(s)
a="Yes"

for i in range (0,N):
  if i%2==0:
    if (s[i]!="R") and (s[i]!="U") and (s[i]!="D"):
      a="No"
      break
  else:
    if (s[i]!="L") and (s[i]!="U") and (s[i]!="D"):
      a="No"
      break
print(a)

Submission status: Accepted

Solution code:
S = input()


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    odd = False
    even = False

    odds = []
    evens = []
    for i, s in enumerate(list(input())):
        if i % 2 == 0:
            evens.append(s in ['R', 'U', 'D'])
        else:
            odds.append(s in ['L', 'U', 'D'])

    odd = odds.count(False) == 0
    even = evens.count(False) == 0

    r = 'No'
    if odd and even:
        r = 'Yes'

    print(r)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a=list(input())
b=a[0::2]
c=a[1::2]
d=b.count("L")
e=c.count("R")
if d != 0:
    ans="No"
elif e != 0:
    ans="No"
else:
    ans="Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
check = 0
for i in range(len(S)):
  if i % 2 == 0:
    if (S[i] == 'R' or S[i] == 'U' or S[i] == 'D') and len(S) >= 1 and len(S) <= 100:
        check += 1
  elif i % 2 == 1:
    if (S[i] == 'L' or S[i] == 'U' or S[i] == 'D') and len(S) >= 1 and len(S) <= 100:
        check += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S= list(input())


index_num_R = [n for n, v in enumerate(S) if v == "R"]
index_num_L = [n for n, v in enumerate(S) if v == "L"]


count_R = 0
count_L = 0

for num_R in index_num_R:
  if num_R %2==1:
    count_R = count_R +1

  
for num_L in index_num_L:
  if num_L %2==0:
    count_L = count_L +1


if count_R==0 and count_L==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a = input()
a_num = int(len(a))
a_list = [i for i in a]
b = 0
for j in range(0,a_num,2):
     try:   
      if a_list[j] == "L" or a_list[j+1] == "R":
        print("No")
        b = 1
        break
     except:
         break
if b == 0:
    print("Yes")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

s = str(raw_input())

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

print("Yes")

Submission status: Accepted

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

for i in kisuu:
  if i == 'R' or i == 'U' or i == 'D':
    hantei.append('ok')
  else:
    hantei.append('no')

for j in guusuu:
  if j == 'L' or j == 'U' or j == 'D':
    hantei.append('ok')
  else:
    hantei.append('no')

ans = hantei.count('no')
if ans > 0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = input()

S1 = S[0::2]
S2 = S[1::2]

if ("R" in S2) or ("L" in S1):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = len(S)

for i in range(N//2):
    if (S[i*2] == 'R' or S[i*2] == 'U' or S[i*2] == 'D') and \
            (S[i*2 + 1] == 'L' or S[i*2 + 1] == 'U' or S[i*2 + 1] == 'D'):
        continue
    else:
        print('No')
        exit(0)
if N%2 != 0:
    if S[N-1] == 'R' or S[N-1] == 'U' or S[N-1] == 'D':
        print('Yes')
    else:
        print('No')
        exit(0)
else:
    print('Yes')

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    if all(si in ["R", "U", "D"] for si in s[::2]) and all(si in ["L", "U", "D"] for si in s[1::2]):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
S = list(input())
result = "Yes"
for i in  S[0::2]:
    if i == "L":
        result = "No"
for i in  S[1::2]:
    if i == "R":
        result = "No"

print(result)

Submission status: Accepted

Solution code:
S = input()
r = 'Yes'
for i, l in enumerate(S):
    p = 'LUD' if (i + 1) % 2 == 0 else 'RUD'
    if not l in p:
        r = 'No'
        break
print(r)

Submission status: Accepted

Solution code:
tap = input()
list = [str(i) for i in tap]
Even = list[1::2]
Odd = list[0::2]

if 'L' in Odd or 'R' in Even:
        print('No')
else:
        print('Yes')

Submission status: Accepted

Solution code:
S = input()
b = list(S)
a = b[0::2]
c = b[1::2]
d = len(a)
e = len(c)
cnt = 0
f = a.count('R')
g = a.count('U')
h = a.count('D')
i = f + g + h



j = c.count('L')
k = c.count('U')
l = c.count('D')
m = j + k + l



if i == d and m == e:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#ABC141_B
S = list(input())
flag1 = 1
flag2 = 1
for i in range(len(S)):
    if i % 2 == 1:
        if S[i] != "L"and S[i] != "U"and S[i] != "D":
            flag1 = 0
            break
    else:
        if S[i] != "R"and S[i] != "U"and S[i] != "D":
            flag2 = 0
            break

if flag1 == 1 and flag2 == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input().strip()
P = S[0::2] 
Q = S[1::2]
P1 = str(P)
Q1 = str(Q)

result = []
P2 = 'L' in P1
Q2 = 'R' in Q1

if (P2 == True) or (Q2 == True):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=input()
flag=True
for i in range(len(S)):
    if((i%2==0) and (S[i]=="R" or S[i]=="U" or S[i]=="D")) or ((i%2==1) and (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()

ctr = True
for i in range(len(S)):
    if i%2 ==0:
        # 奇数
        if S[i]!='R' and S[i]!='U' and S[i]!='D':
            ctr = False
            print('No')
            break
    else:
        # 偶数
        if S[i]!='L' and S[i]!='U' and S[i]!='D':
            ctr = False
            print('No')
            break

if(ctr):
    print('Yes')

Submission status: Accepted

Solution code:
from sys import exit
a = input()

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

for i in range(len(a)):
    if (i+1) % 2 == 0:
        if a[i] not in odd:
            print("No")
            exit()
    elif (i+1) % 3 == 0 or i == 0:
        if a[i] not in p:
            print("No")
            exit()
    else:
        if a[i] not in p:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
c=0
for i in range(0,len(s),2):
    if s[i] in "RUD":
        c+=1
for i in range(1,len(s),2):
    if s[i] in "LUD":
        c+=1
if c==len(s):print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
def _input():
    string = input()
    return list(string)

def is_easy_dance(movings):
    index = 0
    for i in movings:
        if index % 2 == 0:
            if i == 'R' or i == 'U' or i == 'D':
                pass
            else:
                return 'No'
        else:
            if i == 'L' or i == 'U' or i == 'D':
                pass
            else:
                return 'No'
        index += 1
        if index == len(movings):
            return 'Yes'

if __name__ == "__main__":
    movings = _input()
    print(is_easy_dance(movings))

Submission status: Accepted

Solution code:
S = str(input())

checker = True
for i in range(len(S)):
    if i%2 == 0: #odd
        if S[i] == "L":
            print("No")
            checker = False
            break
    else:
        if S[i] == "R":
            print("No")
            checker = False
            break

if checker:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = stdin.readline().rstrip()
cnt = 0
for i in range(len(n)):
    if i%2 == 0:
        if n[i] == "R" or n[i] == "U" or n[i] == "D":
            cnt+= 1
        else:
            print("No")
            exit()

    else:
        if n[i] == "L" or n[i] == "U" or n[i] == "D":
            cnt+=1
        else:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
flag = 0
char_num = len(S)
chk = char_num%2

#even
for i in range(1,int(char_num/2)+1):
  #  print(S[i*2-1],(i*2-1))
    if (S[i*2-1]=='R'):
        print('No')
        flag = 1
        break

            
#odd
if flag == 0:
    for i in range(int(char_num/2)):
       # print(S[(i)*2],i*2)
        if (S[i*2]=='L'):
            print('No')
            flag = 1
            break
if chk == 1:  
   # print(S[-1],char_num-1)
    if flag == 0:
        if (S[-1]=='L'):
            print('No')
            flag = 1

if flag == 0:
        print('Yes')

Submission status: Accepted

Solution code:
S = list(input())
a = 0

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


    
if a == 1:
    print("No")

else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

count = 0

even = []
odd = []
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] == "R":
            count += 1
    if i % 2 == 0:
        if s[i] == "L":
            count += 1
            

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

Submission status: Accepted

Solution code:
S = input()
S_l = []
for i in range(len(S)):
    S_l.append(S[i:i+1])
#print(S_l)

E = [S_l[i] for i in range(len(S)) if i%2 == 1]
O = [S_l[i] for i in range(len(S)) if i%2 == 0]
#print(E)
#print(O)

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

ans = 0
for i in O:
    if i in odd:
        ans = ans
    else:
        ans += 1

for i in E:
    if i in even:
        ans = ans
    else:
        ans += 1

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

Submission status: Accepted

Solution code:
S = str(input())
length = len(S)
n = 0

while length > n:
  if n == 0 or n % 2 == 0:
    if S[n] == 'R' or  S[n] == 'U' or  S[n] == 'D':
      n += 1
      continue
    else:
      print("No")
      break
  else:
    if S[n] == 'L' or  S[n] == 'U' or  S[n] == 'D':
      n += 1
      continue
    else:
      print("No")
      break
if n == length:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
pos = True
for i in range(0, len(a)):
  if i % 2 == 0 and a[i] == 'L':
    print("No")
    pos = False
    break
  if i % 2 == 1 and a[i] == 'R':
    print("No")
    pos = False
    break
    
if pos == True:
  print("Yes")

Submission status: Accepted

Solution code:
def check(*a_list):
    ele_odd = len(a_list[0::2])
    ele_even = len(a_list[1::2])
    count = 0
    for i in a_list[0::2]:
        if i == "R":
            count += 1
        if i == "D":
            count += 1
        if i == "U":
            count += 1
    if count != ele_odd:
        return "No"

    count = 0
    for i in a_list[1::2]:
        if i == "L":
            count += 1
        if i == "D":
            count += 1
        if i == "U":
            count += 1
    if count != ele_even:
        return "No"
    return "Yes"


S = input()
print(check(*S))

Submission status: Accepted

Solution code:
input_line = input()
def check():
  num = 1
  for i in input_line:
      if num % 2 == 1 and i == 'L':
          return 'No'
          break
      elif num % 2 == 0 and i == 'R':
          return 'No'
          break
      elif num % 2 == 1 and i == 'R' or i == 'U' or i == 'D':
          pass
      elif num % 2 == 0 and i == 'L' or i == 'U' or i == 'D':
          pass
      num += 1

if check() == 'No':
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

L_o = ['R','U','D']
L_e = ['L','U','D']
c = 0
l = len(s)

for i in range(l): #文字数だけループ
    if i%2 ==0 : #偶数
        for j in range(l):
            if 'L' in inp[i]: #Rを検索
                print('No')
                exit() 
    elif i%2 ==1: #奇数
        for k in range(3):
            if 'R' in inp[i]:
                print('No')
                exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

frg = 0

for i in s[0::2]:
    if i in odd:         #偶数のものが奇数番にあったらよくない
        frg += 1

for i in s[1::2]:
    if i in even:
        frg += 1

if frg == len(s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
a = list(s)
#print(len(s))
bad_count = 0

for i in range(len(s)):
 # print(a[2 * i: 2* i + 1:1])
 # print(a[2 * i + 1 : 2 * i + 1 + 1 : 1])
 # print(i)
  if(i % 2 == 1):		# EVEN
    if a[i] == "R":
      bad_count += 1
    #  print("ODD",bad_count)
  else:
    if a[i] == "L":	# ODD
      bad_count += 1
    #  print("EVEN",bad_count)

#print(bad_count)

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

Submission status: Accepted

Solution code:
S = input("")
S = list(S)
S_len = len(S)
S_even = []
S_odd = []
index_even = 0
index_odd = 1
while index_even < S_len:
    S_odd.append(S[index_even])
    index_even += 2
while index_odd < S_len:
    S_even.append(S[index_odd])
    index_odd += 2
count_L = S_odd.count("L")
count_R = S_even.count("R")
if count_L == 0 and count_R == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
odd = []
even = []
for i, c in enumerate(s):
  if i % 2 == 0:
    odd.append(c)
  else:
    even.append(c)
if "L" in odd or "R" in even:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
s = input()
if 'R' in ''.join(s[1::2]):
    print('No')
elif 'L' in ''.join(s[0::2]):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
str = input()

list = list(str)

i = 0
f = True
for l in list:
    i+=1
    if i%2 != 0:
        if l == "L":
            f=False
            break
    else:
        if l == "R":
            f=False
            break

if(f):
    print("Yes",end="\n")
else:
    print("No",end="\n")

Submission status: Accepted

Solution code:
s = list(input())
if set(s[0::2]).issubset(['D', 'R', 'U']) and set(s[1::2]).issubset(['D', 'L', 'U']):
    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':
        break
    elif i % 2 == 1 and s[i] == 'R':
        break
else:
    print("Yes")
    exit(0)

print("No")

Submission status: Accepted

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

k = s[0::2]
g = s[1::2]

d = 0

for i in range(len(k)):
  if k[i] == "L":
    print("No")
    d = 1
    break

if d == 0:
  for i in range(len(g)):
    if g[i] == "R":
      print("No")
      d = 1
      break
if d == 0:
  print("Yes")

Submission status: Accepted

Solution code:
steps = list(str(input()))
kisu = ["R", "U", "D"]
gusu = ["L", "U", "D"]
flag = "Yes"

for n in range(len(steps)):
    # 奇数
    if n % 2 != 1:
        if steps[n] in kisu:
            continue
        else:
            flag = "No"
            break
    # 偶数
    else:
        if steps[n] in gusu:
            continue
        else:
            flag = "No"
            break

print(flag)

Submission status: Accepted

Solution code:
K=input()

def find(A):
    n=0
    for letter in A:
        n+=1
        if n%2==0:
            if A[n-1]=="R":
                return True
        if n%2==1:
            if A[n-1]=="L":
                return True

if find(K) ==True:
    print("No")
else :
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
S = [str(c) for c in s]
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=input()
ki=s[2::2]
gu=s[1::2]
ki=s[0]+ki
if 'L' in ki:
    print('No')
elif 'R' in gu:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
odd=["R","U","D"]
even=["L","U","D"]
 
S=input()
 
k=0
for i in range(0,len(S),2):
  if S[i] not in odd:
    break
  else:
    k=k+1
 
for i in range(1,len(S),2):
#  print(i)
  if S[i] not in even:
#    print("No")
    break
  else:
    k=k+1
 
if k==len(S):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

ans = int(0)

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def judge() -> bool:
    for i in range(len(S)):
        if S[i] == 'U' or S[i] == 'D':
            continue
        elif (i+1) % 2 == 0 and S[i] != 'L':
            return False
        elif (i+1) % 2 == 1 and S[i] != 'R':
            return False
    return True

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

Submission status: Accepted

Solution code:
s = input()
ans = 1

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

Submission status: Accepted

Solution code:
S=input()
lS=list(S)
o=0
e=0

for i in range(len(lS)):
    if i % 2 == 0:
        if lS[i]=='R':
            e=e+1
        elif lS[i]=='U':
            e=e+1
        elif lS[i]=='D':
            e=e+1
    elif i % 2 == 1:
        if lS[i]=='L':
            o=o+1
        elif lS[i]=='U':
            o=o+1
        elif lS[i]=='D':
            o=o+1

if o+e==len(lS):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())
counter = 1

for i in S:
  if counter%2 == 1:
    if i=="R" or i == "U" or i == "D":
      counter = counter + 1
    else:
      print("No")
      break
  else:
    if i=="L" or i == "U" or i == "D":
      counter = counter + 1
    else:
      print("No")
      break

if counter == len(S)+1:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = False

for s in S[::2]:
    if s == 'L':
        flag = True

if not flag:
    for s in S[1::2]:
        if s == 'R':
            flag = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
odd = s[0::2]
odd = ','.join(odd)
odd.split(',')
even = s[1::2]
even = ','.join(even)
even.split(',')
if 'L'  not in odd and 'R' not in even:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
letters = list(input())
result = 0
lengs = int(len(letters))
while True:
  if (result + 1) % 2 == 1 and letters[result] == "L":
    print("No")
    break
  elif (result + 1) % 2 == 0 and letters[result] == "R":
    print("No")
    break
  elif (result + 1) == lengs:
    print("Yes")
    break
  else:
    result += 1

Submission status: Accepted

Solution code:
S = input()

string = list(S)
judge = True

for i in range(1,len(string)+1):
    if string[i-1] == 'U' or string[i-1] == 'D':
        pass
    elif string[i-1] == 'L' and i % 2 == 0:
        pass
    elif string[i-1] == 'R' and i % 2 == 1:
        pass
    elif string[i-1] == 'R' and i == 1:
        pass
    else:
        judge = False
if judge == True:
    print('Yes')
elif judge == False:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s_list =  list(s)
jun = 0
ans = 1

while(len(s_list)):
    if jun % 2 == 0:
        if s_list[jun] == "L":
            ans = 0
    if jun % 2 == 1:
        if s_list[jun] == "R":
            ans = 0
    jun += 1
    if jun == len(s_list):
      break
if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
ods = []
evs = []
ods = s[0::2]
evs = s[1::2]

cnt = 0
cnt2 = 0
youo = len(ods)        
youe = len(evs)
cnt += ods.count('R')
cnt += ods.count('U')         
cnt += ods.count('D')
  
cnt2 += evs.count('L')
cnt2 += evs.count('U')         
cnt2 += evs.count('D') 

if cnt == youo and cnt2 == youe:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = list(input())
odd = s[0::2]
even = s[1::2]
if 'R' not in even and 'L' not in odd:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())
K = set()
G = set()
a = 0
flag = 0
for i in S:
  f = a % 2
  if f == 1:
    K.add(S[a])
  else:
    G.add(S[a])
  a += 1 
  
for k in K:
  if k == "R":
    flag = 1
    
for g in G:
  if g == "L":
    flag = 1
    
if flag == 1:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())
even = s[0::2]
odd = s[1::2]

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