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

k = 0
for i,a in enumerate(s):
    j = i+1
    if j%2 == 0 and a == "R":
        k += 1
        break
    elif j%2 == 1 and a == "L":
        k += 1
        break

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())

    for i, s in enumerate(S, start=1):
        if i%2 == 1:
            if s not in ('R', 'U', 'D'):
                return 'No'
        else:
            if s not in ('L', 'U', 'D'):
                return 'No'

    return 'Yes'


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:

S = input()

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
easy = True
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "L":
            easy = False
            break
    else:
        if s[i] == "R":
            easy = False
            break

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

Submission status: Accepted

Solution code:
S=raw_input()
for i,s in enumerate(S):
	if i%2==0:
		if s not in ("R","U","D"):
			print "No"
			quit()
	else:
		if s not in ("L","U","D"):
			print "No"
			quit()
else:
	print "Yes"

Submission status: Accepted

Solution code:
S=input()
flag=0
O=["R","U","D"]
E=["L","U","D"]
for i in range(len(S)):
    if i%2==0:
        if S[i] not in O:
            flag=1
    else:
        if S[i] not in E:
            flag=1
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]

S = input()
a = all([s in "RUD" for i, s in enumerate(S) if i % 2 == 0])
b = all([s in "LUD" for i, s in enumerate(S) if i % 2 == 1])
if a and b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = list(str(input()))
l1 = ["R", "U", "D"]
l2 = ["L", "U", "D"]

ans = "Yes"
for i, c in enumerate(s):
    if i % 2 == 0 and c not in l1:
        ans = "No"
    elif i % 2 == 1 and c not in l2:
        ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S=list(input())

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

Submission status: Accepted

Solution code:
S = input()

odd_letter = {'R', 'U', 'D'}
even_letter = {'L', 'U', 'D'}
odds = S[0::2]
evens = S[1::2]

if set(odds) <= odd_letter and set(evens) <= even_letter:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

n = len(s)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = "Yes"

for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != "L" and s[i] != "U" and s[i] != "D":
            ans = "No"
    if i % 2 == 0:
        if s[i] != "R" and s[i] != "U" and s[i] != "D":
            ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if len(S) % 2 == 1:
    S += "L"

for i in range(0, len(S), 2):
    l = S[i]
    r = S[i + 1]

    if not (l == "R" or l == "U" or l == "D"):
        print("No")
        break

    if not (r == "L" or r == "U" or r == "D"):
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_line = input()

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

print('Yes')

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


S = sys.stdin.readline().rstrip()

O = []
E = []

for i, s in enumerate(S, 1):
    if i % 2 == 0:
        E.append(s)
    else:
        O.append(s)

if "R" not in E:
    if "L" not in O:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
S=list(input())

rud=['R','U','D']
lud=['L','U','D']
odd=[S[i] for i in range(len(S)) if i%2==1]
eve=[S[i] for i in range(len(S)) if i%2==0]

for o in odd:
  if o not in lud:
    print('No')
    exit()
for e in eve:
  if e not in rud:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()

ans = 'Yes'
i = 1
for c in s:
    if i % 2 == 1 and c == 'L':
        ans = 'No'
        break
    elif i % 2 == 0 and c == 'R':
        ans = 'No'
        break
    i += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import bisect

mod = 10**9+7
dd = ((-1,0),(1,0),(0,-1),(0,1))

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def S(): return((list(sys.stdin.readline()))[:-1])

def GCD(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def LCM(a,b):
    return a * b // GCD(a,b)

def main():
    s = S()
    for i in range(len(s)):
        if i%2==0 and s[i] == "L":
            return "No"
        if i%2==1 and s[i] == "R":
            return "No"
    return "Yes"

if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
Do = {"R","U","D"}
De = {"L","U","D"}
S = input().strip()
ind = 1
for i in range(len(S)):
    if (i+1)%2==1:
        if S[i] not in Do:
            ind = 0
            break
    elif (i+1)%2==0:
        if S[i] not in De:
            ind = 0
            break
if ind==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flg = True
for n in range(len(S)):
  if n%2==0 and (S[n]!='R' and S[n]!='U' and S[n]!='D'):
    flg=False
  if n%2==1 and (S[n]!='L' and S[n]!='U' and S[n]!='D'):
    flg=False
if flg:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = input()

ans = "Yes"
for i in range(len(S)):
    if i % 2 and S[i] == 'R':
        ans = "No"
    elif i % 2 == 0 and S[i] == 'L':
        ans = "No"

print(ans)

Submission status: Accepted

Solution code:
tap = input()
cnt=1
for chat in tap:
    if cnt%2==0:
        if chat == "L" or chat =="U"or chat =="D":
            cnt+=1
        else:
            print("No")
            break
    else:
        if chat == "R" or chat =="U"or chat =="D":
            cnt+=1
        else:
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
S = input()
odd_f = True
even_f = True

for i, s in enumerate(S):
    if (i) % 2 == 0:
        if S[i] == 'L':
            odd_f = False
    else:
        if S[i] == 'R':
            even_f = False
if odd_f and even_f:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input()
b=0
for i in range(len(a)):
    if i%2==0:
        if a[i]=="L":
            b+=1
            break
    else:
        if a[i]=="R":
            b+=1
            break

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

Submission status: Accepted

Solution code:
s = input()

ans = 'Yes'

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

print(ans)

Submission status: Accepted

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

s1 = s[::2]
s2 = s[1::2]

if 'L' in s1 or 'R' in s2:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
a = input()
length = len(a)
dame=0

for i in range(0,int(length),2):
  if a[i] == "L":
    dame += 1
    break
for i in range(1,int(length),2):
  if a[i]=="R":
    dame += 1
    break
    
if dame == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=list(input())
flg=0
for i in range(len(s)):
  if i%2==0: #KISU
    if s[i] =='L':
      flg=1
  elif i%2!=0: #GUSU
    if s[i] =='R':
      flg=1
if flg==1:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
#N,A,B = map(int,input().split())
#X_list = list(map(int,input().split()))
#X1_list = [int(input()) for i in range(N)]
#X2_list = [list(map(int,input().split())) for i in range(N)]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s=input()
s1=s[::2];s2=s[1::2]
if 'L' in s1:print("No")
elif 'R' in s2:print("No")
else:print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S = input()

for s in S[0::2]:
    if s in 'RUD':
        pass
    else:
        print('No')
        sys.exit()

for s in S[1::2]:
    if s in 'LUD':
        pass
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
s = list(input())
ans = True
odds = ["R","U","D"]
evens = ["L","U","D"]
for i in s[::2]:
    if not i in odds:
        ans = False

for j in s[1::2]:
    if not j in evens:
        ans = False

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(input())
ki = ["R", "U", "D"]
gu = ["L", "U", "D"]
ans = 0
for i in range(len(S)):
    if (i%2 == 0) and (S[i] not in ki):
        ans += 1
    elif (i%2 == 1) and (S[i] not in gu):
        ans += 1

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

Submission status: Accepted

Solution code:
S = input()


ki = ['R', 'U', 'D']
gu = ['L', 'U', 'D']

c = 0
for s in range(len(S)):
    if s % 2 == 0:
        if S[s] in ki:
            c += 1
    else:
        if S[s] in gu:
            c += 1
# print(c)
if c == len(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S=input()
judge=0
for i in range(len(S)):
    if i%2==0:
        if S[i]=="L":
            judge=1
    else:
        if S[i]=="R":
            judge=1
if judge==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

flag = True
odd_conds = ["R", "U", "D"]
even_conds = ["L", "U", "D"]
for i, c in enumerate(S):
    j = i+1
    if j %  2 == 0 and c in even_conds:
        pass
    elif j % 2 == 1 and c in odd_conds:
        pass
    else:
        flag = False
        break

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

Submission status: Accepted

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


S = input()
print(calc(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

S = list(S)

flg = 0

for i in range(1, len(S)+1, 1):


        if i%2!=0:
                if "L"==S[i-1]:
                        flg = 1
                        break
        elif i%2==0:
                if "R"==S[i-1]:
                        flg = 1
                        break



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

Submission status: Accepted

Solution code:
S = input()
cnt = 0
for s in S:
  if cnt % 2 == 0:
    if s not in ['R', 'U', 'D']:
      print('No')
      exit()
  else:
    if s not in ['L', 'U', 'D']:
      print('No')
      exit()
  cnt += 1
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
print('Yes' if not any(S[i] == 'LR'[i % 2] for i in range(N)) else 'No')

Submission status: Accepted

Solution code:
def main():
    s = list(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')



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin, exit
S = stdin.readline().rstrip()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for s in S[0::2]:
    if s not in odd:
        print('No')
        exit()
for s in S[1::2]:
    if s not in even:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

def main():
    S = input()
    N = len(S)
    ans = "Yes"
    for i in range(N):
        if i % 2 == 0 and S[i] == "L":
            ans = "No"
            break
        elif i % 2 == 1 and S[i] == "R":
            ans = "No"
            break
    print(ans)

if __name__ == '__main__': main()

Submission status: Accepted

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

print(output)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 1
answer = 0
for i in s:
    if count % 2 == 1:
        if i == 'R' or i == 'U' or i == 'D':
            answer += 0
        else:
            answer += 1
    elif count % 2 == 0:
        if i == 'L' or i == 'U' or i == 'D':
            answer += 0
        else:
            answer += 1
    count += 1
if answer == 0:
    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'
            break
    else:
        if s[i] == 'R':
            ans = 'No'
            break

print(ans)

Submission status: Accepted

Solution code:
S = input()
l = len(S)
judge = True
for ii in range(l):
    if ii%2==0: # odd
        if S[ii]=='L':
            judge = False
    if ii%2==1: # even
        if S[ii]=='R':
            judge = False
if judge:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
ans=0
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==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
#B

s = input()
flag = 0

for i in range(len(s)):
    if i%2 == 0:#奇数文字目
        if s[i] == "L":
            flag = 1
    else:
        if s[i] == "R":
            flag =1
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def resolve():
    s = input()

    for i in range(len(s)):
        # 奇数文字目
        if i % 2 == 0:
            if s[i] == 'L':
                print('No')
                return
        else:
            if s[i] == 'R':
                print('No')
                return

    print('Yes')




resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
steps = input()

i = 1
for step in steps:
    if i % 2 == 0:
        if step in ("L", "U", "D"):
            i = i + 1
            continue
        else:
            print("No")
            exit(0)
    else:
        if step in ("R", "U", "D"):
            i = i + 1
            continue
        else:
            print("No")
            exit(0)

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
gu = ['R','U','D']
ki = ['L','U','D']
bad = False
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in gu:
            bad = True
    else:
        if s[i] not in ki:
            bad = True
if bad:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=input()
f = True
for s in S[::2]:
 if s not in {"R", "U", "D"}:
   f=False

for s in S[1::2]:
 if s not in {"L", "U", "D"}:
   f=False

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

Submission status: Accepted

Solution code:
odds = ['R','U','D']
evens = ['L','U','D']

s = input()

fl = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odds:
            fl = 1
            break
    if i % 2 == 1:
        if s[i] not in evens:
            fl = 1
            break

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

Submission status: Accepted

Solution code:
S = input()
temp = 1
result = 0
for i in S:
    if (temp % 2 == 0):
        if (i == "R"):
            result = 1
    else:
        if (i == "L"):
            result = 1
    temp += 1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 15 20:38:11 2019

@author: Yamazaki Kenichi
"""

S = input()

counta = 1
ans = "Yes"
for c in S:
    if counta & 1:
        if c == "L":
            ans = 'No'
    else:
        if c == 'R':
            ans = 'No'
    counta += 1

print(ans)

Submission status: Accepted

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    S = input().rstrip()
    LS = len(S)
    o = set(["R","U","D"])
    e = set(["L","U","D"])
    for i in range(LS):
        if i%2 == 0:# odd
            if S[i] not in o:
                print("No")
                exit()
        else:
            if S[i] not in e:
                print("No")
                exit()
    print("Yes")



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
k = 'R'
g = 'L'

result = 'Yes'

for i, j in enumerate(s):
    if i % 2 == 0:
        if j == g:
            result = 'No'
            break
    else:
        if j == k:
            result = 'No'
            break
print(result)

Submission status: Accepted

Solution code:
S = input()

t = {
    1: ['L', 'U', 'D'],
    0: ['R', 'U', 'D'],
}

ans = 0

for i in range(len(S)):
    if S[i] in t[i % 2]:
        ans += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = list(input().strip())

for i in range(len(l)):
    # odd
    if i % 2 == 0:
        if l[i] not in ['R', 'U', 'D']:
            print('No')
            exit()
    else:
        if l[i] not in ['L', 'U', 'D']:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

for i in range(l):
  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:
kisuu = ["R", "U", "D"]

guusuu = ["L", "U", "D"]

S = str(input())


flag = True
for i in range(len(S)):
    if i % 2 == 0:  # 奇数文字目なら
        if S[i] not in kisuu:
            flag = False

    if i % 2 == 1:
        if S[i] not in guusuu:
            flag = False

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline



    ss = str(input()[:-1])

    for s in ss[::2]:
        if s == 'L':
            print('No')
            exit()

    for s in ss[1::2]:
        if s == 'R':
            print('No')
            exit()
    print('Yes')

Submission status: Accepted

Solution code:
def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    return read_line()


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    odd = data[::2]
    even = data[1::2]

    return 'Yes' if odd.find('L') == -1 and even.find('R') == -1 else 'No'


def write(result):
    print(result)


if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    # import sys
    # sys.setrecursionlimit(10000)
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

isok=True
for i,s in enumerate(S):
    if (i+1) % 2 == 0:
        if s=='R':
            isok=False
            break
    else:
        if s=='L':
            isok=False
            break

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