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()
n = len(s)
a = 0
if n % 2 == 0:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
else:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
if a == 0:
  print("Yes")
if a == 1:
  print("No")

Submission status: Accepted

Solution code:
S=input()
print('Yes' if all([s=='R'or s=='U' or s=='D' for s in S[::2]]) and all([t=='L'or t=='U' or t=='D' for t in S[1::2]]) else 'No')

Submission status: Accepted

Solution code:
s=list(input())

od = ["R","U","D"]
ev = ["L","U","D"]
flag = False
for i in range(len(s)):
    if i%2 ==0:
        if s[i] not in od:
            flag = False#print("No")
            break
        else:
            flag = True
    elif i%2 == 1:
        if s[i] not in ev:
            flag = False#print("No")
            break
        else:
            flag = True
if flag:      
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=str(input())
num=len(s)
ans=True
for i in range(num):
    if i%2==0:
        if s[i]=='L':
            ans=False
    else:
        if s[i]=='R':
            ans=False

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

Submission status: Accepted

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

Submission status: Accepted

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

def isGoodTap(s):
    for i, x in enumerate(s):
        if i%2:
            if x == 'R': return False
        else:
            if x == 'L': return False
    return True

def main():
    s = input()
    if isGoodTap(s): print("Yes")
    else: print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
pos=input()
N=len(pos)
flag=False
for i in range(0,N):
    if i %2==0:
        if not(pos[i]=='R' or pos[i]=='U' or pos[i]=='D'):
            flag=True
            break
    elif not(pos[i]=='L' or pos[i]=='U' or pos[i]=='D'):
        flag=True
        break

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

Submission status: Accepted

Solution code:
S = input()
m = "Yes"
for i, t in enumerate(S):
    if i%2 == 0 and t == 'L' or i%2 == 1 and t == 'R':
        m = "No"
        break
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
flag = 0

for i, c in enumerate(s):
  if (i % 2 == 0) and (c == "L"):
    flag = 1
  elif (i % 2 == 1) and (c == "R"):
    flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

So = S[::2]
Se = S[1::2]

if 'L' in So or 'R' in Se:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = list(input())

gu = S[1::2]
ki = S[0::2]
ans = ''
count = 0

if 'L' in ki or 'R' in gu:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

i=0
f=True

for c in s:
  i += 1
  if i%2==1 and c=='L':
    f=False
  if i%2==0 and c=='R':
    f=False

print('Yes' if f==True else 'No')

Submission status: Accepted

Solution code:
S=str(input())
N=len(S)

for i in range(N):
    if i%2==0 and S[i]=='L':
        print('No')
        break
    if i%2==1 and S[i]=='R':
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
#abc141b

s=raw_input()
so=''
se=''
for i in xrange(1,len(s),2):
 so+=s[i]
for i in xrange(0,len(s),2):
 se+=s[i]
if so.count('L')+so.count('U')+so.count('D')==len(so) and se.count('R')+se.count('U')+se.count('D')==len(se):
 print 'Yes'
else:
 print 'No'

Submission status: Accepted

Solution code:
def resolve():
    s=input()
    ki='RUD'
    gu='LUD'
    for i in range(len(s)):
        if (i%2==0 and s[i] not in ki) or (i%2==1 and s[i] not in gu):
            print('No')
            break
    else:
        print('Yes')
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
a=len(S)

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


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

Submission status: Accepted

Solution code:
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:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
o = len(set(S[1::2]) - {'L', 'U', 'D'})
e = len(set(S[0::2]) - {'R', 'U', 'D'})
print("No" if o+e > 0 else "Yes")

Submission status: Accepted

Solution code:
s = list(input())
sodd = set(s[0::2])
seve = set(s[1::2])
odd ={'R','U','D'}
even ={'L','U','D'}
print('Yes') if (sodd <= odd) and (seve <= even) else print('No')

Submission status: Accepted

Solution code:
S = input()
print ("Yes" if S[::2].count('L') == 0 and S[1::2].count('R')==0 else "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])

ans = "Yes"
for i in odd:
    if i not in "RUD":
        ans = "No"
        break

for i in even:
    if i not in "LUD":
        ans = "No"
        break

print(ans)

Submission status: Accepted

Solution code:
s = input()

for c in s[::2]:
    if c == 'L':
        print('No')
        exit(0)
for c in s[1::2]:
    if c == 'R':
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

Solution code:
s = input()

ans = True
for i in range(len(s)):
    if i % 2 == 1 and s[i] == 'R':
        ans = False
        break
    elif i % 2 == 0 and s[i] == 'L':
        ans = False
        break

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

Submission status: Accepted

Solution code:
import re
hoge = list(input())
i = 0
while i < len(hoge):
    if i%2==0 and re.findall(r'[RDU]',hoge[i]):
        pass
    elif i%2==1 and re.findall(r'[LDU]',hoge[i]):
        pass
    else:
        break
    i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
s = input()
for idx, i in enumerate(s):
    if i not in ['L','U','R','D']:
        print('No')
    elif i == 'R' and (idx+1) % 2 == 0:
        print('No')
        sys.exit()
    elif i == 'L' and (idx+1) % 2 == 1:
        print('No')
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

ans = 'Yes'

for i, c in enumerate(S):
    if i % 2 == 0:
        if c == 'L':
            ans = 'No'
            break
    else:
        if c == 'R':
            ans = 'No'
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC141B - Tap Dance
def main():
    S = input().rstrip()
    flg = "L" not in S[::2] and "R" not in S[1::2]
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
i = 0
flag = True
for c in s:
  i += 1
  if (i % 2 == 0 and c == "R") or (i % 2 == 1 and c == "L"):
    print("No")
    exit(0)
print("Yes")

Submission status: Accepted

Solution code:
s = input()

ans = True

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

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

Submission status: Accepted

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


def solve(S: str):
    s = S

    g_str = s[1::2]
    k_str = s[0::2]

    if "R" in g_str:
        print("No")
    elif "L" in k_str:
        print("No")
    else:
        print("Yes")

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S=input()
for i in range(len(S)):
  if S[i] == 'U':
    pass
  elif S[i] == 'D':
    pass
  elif S[i] == 'R':
    if i % 2 == 1:
      print('No')
      sys.exit()
  elif S[i] == 'L':
    if i % 2 == 0:
      print('No')
      sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
S = list(input())

for i in S[1::2]:
    if i not in ['L', 'U', 'D']:
        print("No")
        exit()

for i in S[0::2]:
    if i not in ['R', 'U', 'D']:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

easy = True
N = len(S)
for i in range(N):
    if (i+1)%2 == 1:
        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:
import sys

s = input()

for i, c in enumerate(s):
    if (i + 1) % 2 == 0 and c in {'L', 'U', 'D'}:
        continue
    elif (i + 1) % 2 == 1 and c in {'R', 'U', 'D'}:
        continue
    else:
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()


def solve():
    for i in range(len(S)):
        s = S[i]
        if i % 2 == 0:
            if s == 'L':
                return False
        else:
            if s == 'R':
                return False

    return True


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

Submission status: Accepted

Solution code:
from sys import stdin
S = (stdin.readline().rstrip())

if (set(S[0::2]) <= {"R","U","D"}) and  (set(S[1::2]) <= {"L","U","D"}):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

str = input()
char_list = list(str)
i = 0
for item in char_list:
    i += 1
    if (i % 2 == 0 and item == 'R'):
        print("No")
        sys.exit()
    if (i % 2 == 1 and item == 'L'):
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
for i,t in enumerate(s):
  if i%2:
    if t == "R":
      print("No")
      break
  else:
    if t == "L":
      print("No")
      break
else:
  print("Yes")

Submission status: Accepted

Solution code:
n = input()
n_list = [i for i in n]
n_len = int(len(n))
for j in range(n_len):
  if j % 2 == 0 and n_list[j] == "L":
    print("No")
    break
  if j % 2 == 1 and n_list[j] == "R":
    print("No")
    break
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
odd = "".join([i for idx,i in enumerate(s) if idx%2==0])
even = "".join([i for idx,i in enumerate(s) if idx%2==1])
if odd.replace("R","").replace("U","").replace("D","") or even.replace("L","").replace("U","").replace("D",""):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
from sys import exit


S = input()

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

Submission status: Accepted

Solution code:
S = input()
char = len(S)

even, odd = [], []

Yes = True

for i in range(char):
  if (i+1)%2 == 0: even.append(S[i])
  else: odd.append(S[i])
    
for i in odd:
  if not(i == 'R' or i == 'U' or i == 'D'): 
    Yes = False
    
for i in even:
  if not(i == 'L' or i == 'U' or i == 'D'): 
    Yes = False
  
if Yes == True: 
  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:
t = input()
c=1
flag = 'Yes'
for i in t:
    if c % 2 ==1:
        if i == 'L':
            flag = 'No'
    else:
        if i =='R':
            flag = 'No'
    c = c +1
print(flag)

Submission status: Accepted

Solution code:

S=list(input())
f=1
e=0
for i in range(len(S)):
    if f:
        f=0
        if S[i]=='L':
            print('No')
            e=1
            break
    elif not f:
        f=1
        if S[i] =='R':
            print('No')
            e=1
            break
if not e:
    print('Yes')

Submission status: Accepted

Solution code:
print("YNeos"[any(c=="RL"[~i%2]for i,c in enumerate(input()))::2])

Submission status: Accepted

Solution code:
s = input()

odds = s[0::2]
if 'L' in odds:
    print('No')
    exit()

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

print('Yes')

Submission status: Accepted

Solution code:
import sys


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


def main():
    S = input()
    ans = "Yes"
    for i in range(len(S)):
        if (i+1) % 2 == 1:
            if S[i] == "L":
                ans = "No"
        else:
            if S[i] == "R":
                ans = "No"
        if ans == "No":
            print(ans)
            exit()
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())

s_odd=''.join(s[0::2]) #偶数項、奇数項に分類する
s_even=''.join(s[1::2])

if s_odd.find('L')==-1 and s_even.find('R')==-1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(S):
    return (all(c in 'RUD' for c in S[::2]) and
            all(c in 'LUD' for c in S[1::2]))
        
print 'Yes' if solve(raw_input()) else 'No'

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = input()
 
for i in range(0,int(len(L))):
	if (i % 2) == 0:
		if L[i] == "L": #奇数
			print("No")
			break
	elif (i % 2) == 1:
		if L[i] == "R":
			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] == 'L':
    print('No')
    break
  if i % 2 == 1 and s[i] =='R':
    print('No')
    break
else:
  print('Yes')

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()
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
  if i%2==1:
    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:
# coding: utf-8
S = input()
even= list(set(S[0::2]))
odd = list(set(S[1::2]))
E = ["R", "U", "D"]
O = ["L", "U", "D"]
cnt = 0
for i in range(len(even)):
    if even[i] in E:
        cnt += 1
if cnt == len(even):
    flag_e = True
else:
    flag_e = False
cnt = 0
for i in range(len(odd)):
    if odd[i] in O:
        cnt += 1
if cnt == len(odd):
    flag_o = True
else:
    flag_o = False
print("Yes" if flag_o and flag_e else "No")

Submission status: Accepted

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

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:
dance = list(input())
kekka = 0

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

if kekka == len(dance):
    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') or (i % 2 == 1 and s[i] == 'R'):
    print("No")
    exit()

print("Yes")

Submission status: Accepted

Solution code:
s=list(input())
if all([x in ['R','U','D'] for x in s[::2]]) and all([x in ['L','U','D'] for x in s[1::2]]):
    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] not in 'RUD':
        print('No')
        break
    elif i%2==1 and s[i] not in 'LUD':
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
i = input()
chars = list(i)
if "R" in chars[1::2]:
    print("No")
elif "L" in chars[0::2]:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
for i in range(len(s)):
    if (i + 1) % 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:
a = input()
b = len(a)

for i in range(b):
  if i % 2 == 0:
    if a[i] == 'R' or a[i] == 'U' or a[i] == 'D':
      continue
    else:
      print('No')
      exit()
  elif i % 2 == 1:
    if a[i] == 'L' or a[i] == 'U' or a[i] == 'D':
      continue

    else:
      print('No')
      exit()
      
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
  inputstr = input()
  size = len(inputstr)
  isEasy = True

  for i in range(size):
    point = i + 1
    if point % 2 == 0:
      if inputstr[i] in ["L", "U", "D"]:
        pass
      else:
        isEasy = False
        break
    else:
      if inputstr[i] in ["R", "U", "D"]:
        pass
      else:
        isEasy = False
        break

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

Submission status: Accepted

Solution code:
import sys
INPUT = sys.stdin.readline
#入力関数
def SORO_INT(): return int(INPUT())
def MULT_INT_LIST(): return list(map(int, INPUT().split()))
def MULT_INT_MAP(): return map(int, INPUT().split())
def SORO_STRING(): return INPUT()
def MULT_STRING(): return INPUT().split()

S = SORO_STRING()
S = list(S)
S_ki = S[0::2]
S_gu = S[1::2]
if 'R' in S_gu:
    print('No')
    sys.exit()
if 'L' in S_ki:
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

a = len(S)
cnt = 0
for i in range(a):
#奇数の場合
  if i % 2==0:
#L以外が含まれる（Lではない）
    if S[i] != "L":
      cnt +=1
    elif S[i] == "L":
      cnt -= 101
#偶数の場合
  elif i %2 ==1:
#R以外が含まれる（Rではない）
    if S[i] != "R":
      cnt +=1
    elif S[i]=="R":
      cnt -= 101

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

Submission status: Accepted

Solution code:
S = input()
S_list = list(S)
odd  = S_list[0::2]
even = S_list[1::2]
flag = "green"

for i in range(len(odd)):
    if odd[i] == "L":
        flag = "red"
for i in range(len(even)):
    if even[i] == "R":
        flag = "red"
if flag == "red":
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
def solve():
    s = input()
    num = 1
    for w in s:
        if num %2 == 0:
            if w == 'L' or w == 'U' or w == 'D':
                num+=1
            else:
                print('No')
                return
        else:
            if w == 'R' or w == 'U' or w == 'D':
                num+=1
            else:
                print('No')
                return
    print('Yes')


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
text = input()
odds= []
evens = []
flag1 = True
flag2 = True
for i in range(0,len(text),2):
    #print(text[i],end=" ")
    if text[i]=='L':
        flag1 = False
        break
    #print("\n")
for j in range(1,len(text),2):
    #print(text[j],end=" ")
    if text[j]=='R':
        flag2 = False
        break
#print(flag1,flag2)
if(not(flag1 and flag2)):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
input0=input("")
e=0
f=0
g=0
i=0

c=input0[::2]
d=input0[1::2]

for a in c:
    b=2
    if(a=="L"):
        b=1
    else:
        b=0
    e=e+b
    
for a in d:
    b=2
    if(a=="R"):
        b=1
    else:
        b=0
    f=f+b

g=e+f

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

judge = True
for i in range(len(s)):
    if ((i % 2 == 0 and s[i] == 'L') or (i % 2 == 1 and s[i] == 'R')):
        judge = False
        break

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

Submission status: Accepted

Solution code:
S = list(input())

Odd = S[0::2]
Even = S[1::2]

for i in range(len(Odd)):
    if 'L' == Odd[i]:
        l = 0
        break
    else:
        l = 1

r = 1
for j in range(len(Even)):
    if 'R' == Even[j]:
        r = 0
        break
    else:
        r = 1

if l+r == 2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
S_o = []
S_e = []
for i in range(len(S)):
    if i%2 == 0:
        S_e.append(S[i])
    elif i%2 == 1:
        S_o.append(S[i])
if ('R' not in set(S_o)) and ('L' not in set(S_e)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
str_s = input()
ret = "Yes"
for i, n in enumerate(str_s):
    i = int(i)
    if (i+2) % 2 == 0:
        if n not in ("R", "U", "D"):
            ret = "No"
            break
    elif (i+1) % 2 == 0:
        if n not in ("L", "U", "D"):
            ret = "No"

print(ret)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()

Ll = [i for i, x in enumerate(s) if x == 'L']
Rl = [i for i, x in enumerate(s) if x == 'R']

for i in range(len(Ll)):
    if Ll[i] % 2 == 0:
        print('No')
        sys.exit()
for i in range(len(Rl)):
    if Rl[i] % 2 == 1:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
dance = input()
num = 0
odd = []
even = []
for i in dance:
    num += 1
    if num %2 == 0:
        even.append(i)
    else:
        odd.append(i)
for i in odd:
    if i == "L":
        print('No')
        sys.exit()
    else:
        pass
for i in even:
    if i == "R":
        print('No')
        sys.exit()
    else:
        pass
print('Yes')

Submission status: Accepted

Solution code:
S=input()
n=len(S)
hantei1,hantei2=1,1
for i in range(0,n,2):
    if S[i]=='R' or S[i]=='U' or S[i]=='D':
        continue
    else:
        hantei1=0
        break

for j in range(1,n,2):
    if S[j]=='L' or S[j]=='U' or S[j]=='D':
        continue
    else:
        hantei2=0
        break

if hantei1 == 1 and hantei2 == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
e = [s[i] for i in range(len(s)) if i%2==0]
o = [s[i] for i in range(len(s)) if i%2!=0]
if 'L' in e or 'R' in o:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
O=S[::2]
E=S[1::2]
cnt=0
for k in O:
  if k in 'RUD':
    cnt+=1
for j in E:
  if j in 'LUD':
    cnt+=1
if cnt==len(S):
  print('Yes')
else:
  print('No')