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

e1 = ['R', 'U', 'D']
e2 = ['L', 'U', 'D']

ans = 'Yes'

for i, c in enumerate(s):
    if ((i+1) % 2 == 0 and c in e2) or ((i+1) % 2 == 1 and c in e1):
        pass
    else:
        ans = 'No'
        break

print(ans)

Submission status: Accepted

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

odd = 'RUD'
even = 'LUD'

for i in range(len(s)):
    if i % 2 == 0:
        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:
ls = list(map(str,input()))
lsa = ls[0::2]
lsb = ls[1::2]
flag = 0
for i in range(len(lsa)):
  if lsa[i] == 'L':
    flag += 1
for i in range(len(lsb)):
  if lsb[i] == 'R':
    flag += 1
if flag != 0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

Solution code:
S=str(input())
i = 0
yasui = True
for s in S:
  if i%2==0 and s=='L':
    yasui = False
  if i%2!=0 and s=='R':
    yasui = False
  i=i+1
if yasui:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=input()
s_odd=s[::2]
s_even=s[1::2]
print("Yes" if s_odd.count("L")==s_even.count("R")==0 else "No")

Submission status: Accepted

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

for a in odd:
   if a == "L":
      print("No")
      exit()

for b in even:
   if b == "R":
      print("No")
      exit()

print("Yes")

Submission status: Accepted

Solution code:
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))


s=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

i = 1
cnt = 0
for s in S:
    if i % 2 != 0:
        if s == 'R' or s == 'U' or s == 'D':
            cnt += 1
            i +=1
        else:
            i +=1
            continue
    elif i % 2 == 0:
        if s == 'L' or s == 'U' or s == 'D':
            cnt += 1
            i+=1
        else:
            i+=1
            continue
if cnt == len(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    odd = 'RUD'
    even = 'LUD'
    ret = 'Yes'
    for n in range(len(S)):
        if (n + 1) % 2 == 0 and S[n] not in even or (n + 1) % 2 != 0 and S[n] not in odd:
            ret = 'No'
    else:
        print(ret)


if __name__ == '__main__':
    main()

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:
S = input()
for i, c in enumerate(S):
    if i % 2 == 0:
        if not c in ("R", "U", "D"):
            print("No")
            break
    else:
        if not c in ("L", "U", "D"):
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

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")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
count1 = 0
count2 = 0
for i in range(l//2 + l%2):
    if s[2*i] == "R" or s[2*i] == "U" or s[2*i] == "D":
        count1 += 1
for j in range(l//2):
    if s[2*j + 1] == "L" or s[2*j + 1] == "U" or s[2*j + 1] == "D":
        count2 += 1
if count1 == l//2 + l%2 and count2 == l//2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    S = input()
    sk = S[::2]
    sg = S[1::2]
    if 'L' not in sk and 'R' not in sg:
        return 'Yes'
    else:
        return 'No'
print(main())

Submission status: Accepted

Solution code:

def ifif(s):
  if s:print("Yes")
  else:print("No")
u=1
s=input()
for k in range(len(s)):
  if s[k]=="L" and k%2==0:
    u=0
  elif s[k]=="R" and k%2==1:
    u=0

ifif(u)

Submission status: Accepted

Solution code:
S = input()
T = "Yes"
for i in range(len(S)):
  if (i+1) % 2 == 1:
    if S[i] != "R" and S[i] != "U" and S[i]!= "D":
      T = "No"
      break
  else:
    if S[i] != "L" and S[i] != "U" and S[i] != "D":
      T = "No"
      break
print(T)

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:
s=input()
kisuu=list("RUD")
guusuu=list("LUD")
ans=0
for i in s[::2]:
    if i not in kisuu:
        ans+=1
for i in s[1::2]:
    if i not in guusuu:
        ans+=1
if ans==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i, name in enumerate(list):
  if i % 2 == 1 and name not in a:
    isOK = False
  elif i % 2 == 0 and name not in b:
    isOK = False
  
print('Yes' if isOK else 'No')

Submission status: Accepted

Solution code:
import sys
S = input()
L = len(S)
i = 0
while i < L:
  if S[i] not in ['R','U','D']:
    print('No')
    sys.exit(0)
  i+=2
i = 1
while i < L:
  if S[i] not in ['L','U','D']:
    print('No')
    sys.exit(0)
  i += 2
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def q2():
    S = list(input())
    ans = 'Yes'
    for i in range(len(S)):
        if i % 2 == 0 and S[i] not in ['R', 'U', 'D']:
            ans = 'No'
        elif i % 2 == 1 and S[i] not in ['L', 'U', 'D']:
            ans = 'No'

    print(ans)


if __name__ == '__main__':
    q2()

Submission status: Accepted

Solution code:
S = input()

#print(len(S))
flag= 0
for i in range(len(S)):
	#print(i,S[i])
	if i % 2 == 0:
		if S[i] == "L" :
			#print(i,S[i])
			flag = 1
	elif i % 2 !=0:
		if S[i] == "R" :
			#print(i,S[i])
			flag = 1

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

Submission status: Accepted

Solution code:
s = input()

flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
sum = 0
for i in range(len(s)):
    if i % 2 != 0:
        if "R" == s[i]:
            sum += 1

    elif i % 2 == 0:
        if "L" == s[i]:
            sum += 1

if sum > 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()

n = len(S)

good = True

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

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

Submission status: Accepted

Solution code:
S = input()
result = 'Yes'

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

Submission status: Accepted

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

Submission status: Accepted

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

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 == 0:
        if not S[i] in even:
            print('No')
            exit()
    else:
        if not S[i] in odd:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()
count = 0
for i, s in enumerate(S, 1):
  if i % 2 != 0:
    count += s != 'L'
  else:
    count += s != 'R'

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

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
for i,j in enumerate(s):
  if i&1 and j == 'R':
    ans = 'No'
  elif 1 - i&1 and j == 'L':
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
k = ['R','U','D']
g = ['L','U','D']
count =0

for i in range(n):
    if i % 2 ==0:
        if s[i] in k:
            count +=1
    else:
        if s[i] in g:
            count += 1
       
if count == n:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
#B 
s = input()

kisu = ['R','U','D']
gusu = ['L','U','D']

flg = False

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in kisu:
            flg = True
        else:
            flg = False
            break
    else:
        if s[i] in gusu:
            flg = True
        else:
            flg = False
            break
                
if flg:
    print('Yes')
    
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
c1 = all([s in ['R', 'U', 'D'] for s in S[::2]])
c2 = all([s in ['L', 'U', 'D'] for s in S[1::2]])
print('Yes' if c1 and c2 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 != 0 and S[i] == 'R':
    print("No")
    break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
print('YNeos'['L' in list(s[0::2]) or 'R' in list(s[1::2])::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

answer = 'Yes'
for i, s in enumerate(S):
    nth = i + 1
    is_odd = nth % 2 == 1
    is_even = not is_odd
    if (
        (is_odd and s in 'RUD') or
        (is_even and s in 'LUD')
    ): continue
    answer = 'No'

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
l = [False for i in range(len(s))]
for i in range(len(s)):
    if i%2==1:#偶数
        l[i] = s[i]=='L' or s[i]=='U' or s[i]=='D'
    else:#奇数
        l[i] = s[i]=='R' or s[i]=='U' or s[i]=='D'
if l == [True for i in range(len(s))]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
for i in list(s[::2]):
    if i not in odd: 
        print("No")
        exit()
for i in list(s[1::2]):
    if i not in even: 
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
S_o=''.join(S[0::2])
S_e=''.join(S[1::2])
print('Yes' if ((not ('L' in S_o)) and (not ('R' in S_e))) else 'No')

Submission status: Accepted

Solution code:
s = input()

flg = True
for i in range(len(s)):
    if s[i] == 'U':
        #print(i,'U')
        continue
    elif s[i] == 'D':
        #print(i, 'D')
        continue
    elif i % 2 == 0 and s[i] == 'R':
        #print(i, 'R')
        continue
    elif i % 2 == 1 and s[i] == 'L':
        #print(i, 'L')
        continue
    else:
        #print(i, 'False')
        flg = False
        break

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

Submission status: Accepted

Solution code:
import math
a = input()
a_half = math.floor(len(a)/2)
count= 0
ans_list_R = ['R', 'U','D']
ans_list_L = ['L', 'U','D']
for i in range(len(a)):
    if i % 2==0:
        if a[i] in ans_list_R:
            count += 1
    else:
        if a[i] in ans_list_L:
            count += 1
if count == len(a) :
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from itertools import *
from collections import *

INF = float('inf')


def main():
    S = input().rstrip()
    str_odd = S[::2]
    str_even = S[1::2]

    if 'L' in str_odd or 'R' in str_even:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  s = input()
  ODD = ['R','U','D']
  EVEN = ['L','U','D']
  slen = len(s)
  
  for i in range(slen):
    if (i+1) % 2 == 0:#even
      #print(s[i])
      if s[i] in EVEN:
        pass
      else:
        print('No')
        exit()
    else:
      #print(s[i])
      if s[i] in ODD:
        pass
      else:
        print('No')
        exit()
  print('Yes')
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
S=input();A='Yes';i=0
while i<len(S):
    if S[i]==['L','R'][i%2]:A='No'
    i+=1
print(A)

Submission status: Accepted

Solution code:
s = input()
a = set(i for j, i in enumerate(s) if j%2==0)
b = set(i for j, i in enumerate(s) if j%2==1)
if (a & {'L'}) or (b & {'R'}):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
odd = ["R","U","D"]
even = ["L","U","D"]
ret = "Yes"
for i,v in enumerate(s):
    l = even
    if i % 2==0:
        l = odd
    if v not in l:
        ret  ="No"
        break
print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
arr1=["R","U","D"]
arr2=["L","U","D"]
for i in range(len(s)):
  if (i%2==0 and not (s[i] in arr1)) or (i%2==1 and not (s[i] in arr2)):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
dancable = True
for i in range(len(S)):
  if i % 2 == 1:
    dancable &= (S[i] == 'L') or (S[i] == 'U') or (S[i] == 'D')
  else:
    dancable &= (S[i] == 'R') or (S[i] == 'U') or (S[i] == 'D')
print('Yes' if dancable else '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:
n = input()
for i in range(len(n)):
    if (i % 2 == 0 and n[i] == "L") or (i % 2 == 1 and n[i] == "R"):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = str(input())
odd = ''
even = ''
for s in range(0,len(S),2):
  odd += S[s]
for s in range(1,len(S),2):
  even += S[s]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sk = ['R','U','D'];sg = ['L','U','D']
S = list(input())
flg = 'Yes'
for i in range(len(S)):
  if i%2 == 0:
    if sk.count(S[i]) == 0:
      flg = 'No'
      break
  else:
    if sg.count(S[i]) == 0:
      flg = 'No'
      break
print(flg)

Submission status: Accepted

Solution code:
S = list(input())
ans = 'Yes'
for i in range(0, len(S), 2):
    if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
        pass
    else:
        ans = 'No'
for i in range(1, len(S), 2):
    if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
        pass
    else:
        ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

check = 0
for i, s in enumerate(S):
    if i % 2 == 0 and s == 'L':
        check = 1
    if i % 2 == 1 and s == 'R':
        check = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
#n = int(input())
#n, k = map(int, sys.stdin.readline().split())
s = input()
#x = list(map(int, sys.stdin.readline().split()))

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

def ki():
    for i in range(0,len(s),2):
        if s[i] != "R" and s[i] != "U" and s[i] != "D":
            return False
    return True

def gu():
    for i in range(1,len(s),2):
        if s[i] != "L" and s[i] != "U" and s[i] != "D":
            return False
    return True

if ki():
    if gu():
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
import numpy as np
from sys import stdin

def main():
  s = input()
  n = len(s)
  
  ok = True
  for i in range(n):
    if (i%2 == 1 and s[i] == "R"):
      ok = False
    if (i%2 == 0 and s[i] == "L"):
      ok = False
  
  if (ok):
    str_ = "Yes"
  else:
    str_ ="No"
    
  print(str_)
  
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [(i%2==0 and chr=='L' or i%2==1 and chr=='R') for chr, i in zip(input(), range(101))]
print('Yes' if not any(s) else 'No')

Submission status: Accepted

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
bl = True
if 'L' in S[0::2] or 'R' in S[1::2]:
    bl = False
print('Yes' if bl else 'No')

Submission status: Accepted

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


print('Yes')

Submission status: Accepted

Solution code:
s = input()
o = ["R", "U", "D"]
e = ["L", "U", "D"]
for i, si in enumerate(s):
    if i % 2 == 0:
        if si not in o:
            print("No")
            exit()
    else:
        if si not in e:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

for i in range(len(S)):
    if i%2==0 and S[i]=='R' or S[i]=='U' or S[i]=='D':
        pass
    elif i%2==1 and S[i]=='L' or S[i]=='U' or S[i]=='D':
        pass
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
#ABC141.B
S= input()
count = 0
if len(S)%2 ==0:
    for i in range(len(S)//2):
        if S[i*2]=='L':
            count +=1
    for m in range(len(S)//2):
        if S[m*2+1]=='R':
            count +=1
elif len(S)%2 ==1:
    for i in range(len(S)//2):
        if S[i*2]=='L':
            count +=1
    for m in range(len(S)//2):
        if S[m*2+1]=='R':
            count+=1
    if S[-1]=='L':
        count+=1
if count ==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
ki = {'R', 'U', 'D'}
gu = {'L', 'U', 'D'}
flg = True
for i in s[0::2]:
  if i in ki:
    continue
  else:
    flg = False
for i in s[1::2]:
  if i in gu:
    continue
  else:
    flg = False
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
import math
S = input()
n = len(S)

for i in range(math.ceil(n/2)):
    if S[2*i] != "R" and S[2*i] != "U" and S[2*i] != "D":
        print("No")
        exit()
for i in range(int(n/2)):
    if S[2*i + 1] != "L" and S[2*i + 1] != "U" and S[2*i + 1] != "D":
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

print("Yes")

Submission status: Accepted

Solution code:
s=input()
count=0

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
even = ["L","U","D"]
odd = ["R", "U", "D"]
f = False
for i in range(len(s)):
  if i%2:
    if s[i] not in even:
      f = True
  else:
    if s[i] not in odd:
      f = True
if f:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
s = input()

for i, s_i in enumerate(s):
    index = i + 1
    if index % 2 == 0:
        if s_i in 'LUD':
            continue
        else:
            print('No')
            break
    else:
        if s_i in 'RUD':
            continue
        else:
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Tap Dance
https://atcoder.jp/contests/abc141/tasks/abc141_b

"""
import sys


def solve(S):
    odds = S[::2]
    evens = S[1::2]
    if all(o in 'RUD' for o in odds) and all(e in 'LUD' for e in evens):
        return 'Yes'
    return 'No'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = list(input())
    even = set(S[1::2])
    odd = set(S[0::2])
    o = {'R', 'U', 'D'}
    e = {'L', 'U', 'D'}
    res = 'Yes'
    if not(even <= e) or not(odd <= o):
        res = 'No'
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
ans = 'Yes'
for i in range(len(s)):
    if i%2!=0 and not(s[i]=='L' or s[i]=='U'or s[i]=='D'):
        ans = 'No'
    elif i%2==0 and not(s[i]=='R' or s[i]=='U'or s[i]=='D'):
        ans = 'No'

print(ans)

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")
        break
else:
    print("Yes")