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:
import sys
s=input()
for i in range(0,len(s),2):
    if s[i]=='L':
        print('No')
        sys.exit()
for k in range(1,len(s),2):
    if s[k]=='R':
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()

evenChecker = 'Yes'
oddChecker = 'Yes'

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

Submission status: Accepted

Solution code:
lists = list(input())


flag = False

for i ,list in enumerate(lists):
    if (i + 1) % 2 == 1:
        if list == "R" or list == "U" or list == "D":
            flag = True
        else:
            flag = False
            break

    if (i + 1) % 2 == 0:
        if list ==  "L" or list == "U" or list == "D":
            flag = True
        else:
            flag = False
            break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
S = list(map(str,input().split()))
S = [c for c in S[0]]

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

Submission status: Accepted

Solution code:
s=raw_input()
a=s[::2]
b=s[1::2]

if "L" in a or "R" in b:
    print "No"
else:
    print "Yes"

Submission status: Accepted

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

  if is_easy(s):
    print("Yes")
  else:
    print("No")

def is_easy(str):
  odd = ["R", "U", "D"]
  even = ["L", "U", "D"]
  rtn = True

  odds = []
  evens = []

  for i in range(len(str)):
    if i % 2 == 0:
      odds.append(str[i])
    else:
      evens.append(str[i])

  for i in range(len(odds)):
    if not odds[i] in odd:
      rtn = False
  for i in range(len(evens)):
    if not evens[i] in even:
      rtn = False
  return rtn

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    for index, s in enumerate(S):
        if index % 2 == 0:
            if s == 'L':
                print('No')
                exit()
        else:
            if s == 'R':
                print('No')
                exit()
    if index == len(S) - 1:
        print('Yes')



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
l = len(S)
s = list(S)
c = 0
s.append("U")

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

Submission status: Accepted

Solution code:
O={'R','U','D'}
E={'L','U','D'}
S=input()
if set(S[::2]) <= O and set(S[1::2]) <= E:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

N = len(S)

gusu = S[1::2]
kisu = S[::2]

g = 1
for i in range(len(gusu)):
    if gusu[i] == "L" or gusu[i] == "U" or gusu[i] == "D":
        g = g*1
    else:
        g = 0

k = 1
for i in range(len(kisu)):
    if kisu[i] == "R" or kisu[i] == "U" or kisu[i] == "D":
        k = k*1
    else:
        k = 0

if g*k == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

# coding: utf-8

# In[3]:


dance = input()


# In[5]:


for i,c in enumerate(dance):
    if i%2==1 and c=="R":
        print("No")
        break
    elif i%2==0 and c=="L":
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()
flag = True
cnt = 1
for char in S:
    if cnt % 2 == 0:
        if not (char == "L" or char == "U" or char == "D"):
            flag = False
    else:
        if not (char == "R" or char == "U" or char == "D"):
            flag = False
    cnt = cnt + 1

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

Submission status: Accepted

Solution code:
while True:
    try:
        string = input()
        for i in range(0, len(string)):
            if i % 2 == 0:
                if string[i] == 'L':
                    print('No')
                    break
            else:
                if string[i] == 'R':
                    print('No')
                    break
        else:
            print('Yes')
    except:
        break

Submission status: Accepted

Solution code:
s = str(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().rstrip()
R = "RUD"
L = "LUD"
r = 0
l = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i] in R:
      #print("ok")
      r += 1
    else:
      print("No")
      break
  elif (i % 2) == 1:
    if S[i] in L:
      #print("OK")
      l += 1
    else:
      print("No")
      break
      
  if (r + l) == len(S):
    print("Yes")

Submission status: Accepted

Solution code:
S=input()
N=len(S)
O={"R","U","D"}
E={"L","U","D"}
A=1
B=1
for i in range(N):
    if i%2==1:
        if S[i] in E:
            B=B*1
        else:
            B=B*0
    else:
        if S[i] in O:
            A=A*1
        else:
            A=A*0


if A*B==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

S = input()

odd = 'R'
even = 'L'

end = len(S)

flag = True

for i in range(0, end, 2):
    if S[i] == even:
        flag = False


for i in range(1, end, 2):
    if S[i] == odd:
        flag = False


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

Submission status: Accepted

Solution code:
#B
s = input()
L = 'L'
R = 'R'
odds = ''
evens = ''
for i in range(len(s)):
    if i % 2 == 0:
        odds += s[i]
    else:
        evens += s[i]
if (L in odds) or (R in evens):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)

S = input()

cnt = 0
if "L" not in S[::2]:
  cnt += 1
if "R" not in S[1::2]:
  cnt += 1  
print("Yes" if cnt == 2 else "No")

Submission status: Accepted

Solution code:
S = input()
c = 0
for i in range(len(S)):

    if i % 2 == 0:
        if S[i] in 'RUD':
            c += 1

    elif i % 2 ==1:
        if S[i] in 'LUD':
            c += 1


if c==len(S):
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
import sys

#+++++
		
def main():
	s = input()
	odd=set(['R','U','D'])
	eve=set(['L','U','D'])
	for i,c in enumerate(s):
		if (i+1) % 2 == 1 and c not in odd:
			return 'No'
		elif (i+1) % 2 == 0 and c not in eve:
			return 'No'
	return 'Yes'
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
S = input()

even = set({})
odd = set({})
for i in range(len(S)):
    if i % 2 == 0:
        even.add(S[i])
    else:
        odd.add(S[i])
#print(even, odd)

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

Submission status: Accepted

Solution code:
s = input()

ans = "Yes"

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

Submission status: Accepted

Solution code:
def TapDance():
	S = input()
	danceEasyOdd = True
	danceEasyEven = True
	for index, step in enumerate(S): 
		if index % 2 == 0:
			if step == 'L':
				danceEasyOdd = False
				break
		else:
			if step == 'R':
				danceEasyEven = False
				break

	if danceEasyOdd and danceEasyEven:
		print('Yes')
	else:
		print('No')

TapDance()

Submission status: Accepted

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

flag = 'Yes'

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

print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf8 -*-

s = [s for s in input()]
pk = ['R', 'U', 'D']
pg = ['L', 'U', 'D']

ans = 'Yes'
for i, n in enumerate(s):
    if i % 2 == 0:
        if n in pk:
            continue
        else:
            ans = 'No'
            break
    else:
        if n in pg:
            continue
        else:
            ans = 'No'
            break
print(ans)

Submission status: Accepted

Solution code:
S = list(str(input()))
S.insert(0, 'L')

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

Submission status: Accepted

Solution code:
rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
 
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(rr()) else 'No'

Submission status: Accepted

Solution code:
S = str(input())
odd_number = [word for i, word in enumerate(S) if (i + 1) % 2 == 1]
even_number = [word for i, word in enumerate(S) if (i + 1) % 2 == 0]

odds = set(odd_number) - set(["R", "U", "D"])
evens = set(even_number) - set(["L", "U", "D"])
del odd_number, even_number, S

if len(odds) == 0 and len(evens) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 22:46:19 2019

"""

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:
s = [i for i in input()]
flg=0
ki = ['R', 'U', 'D']
gu = ['L', 'U', 'D']

for i in range(len(s)):
    if i%2==0:
        if s[i] not in ki:
            flg=1
            break
    elif i%2==1:
        if s[i] not in gu:
            flg=1
            break
        
print('Yes' if flg==0 else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
List = list(S)
odd = []
even = []

for i in range(len(List)):
  if i % 2 == 0:
    odd.append(List[i])
  else:
    even.append(List[i])

if set(odd).issubset({'R','U','D'}) and set(even).issubset( {'L','U','D'}):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
S = input()
l = len(S)
flag=0
for k in range(0,l):
    if k %2 == 1:
        continue
    if not S[k] in 'RDU':
        flag=1
        break

flag2=0
for k in range(0,l):
    if k%2 == 0:
        continue
    if not S[k] in 'LUD':
        flag2=2
        break

if flag==1 or flag2==2:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
steps= input()
stepa = steps[::2]
stepb = steps[1::2]
if stepa.count("L") == 0 and stepb.count("R") == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
ans="Yes"
n = len(s) // 2
for i in range(0,n):
    if s[2*i] == "L":
        ans="No"
    if s[2*i+1] == "R":
        ans="No"
if len(s) % 2 == 1:
    if s[-1] == "L":
        ans="No"

print(ans)

Submission status: Accepted

Solution code:
ans = True
lis = [["R","U","D"],["L","U","D"]]
for i,j in enumerate(input()):
    if not j in lis[i%2]:
        ans = False
if ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

S1 = S[1::2]
S2 = S[::2]
#print(S1)
#print(S2)

for s1 in S1:
	if s1 == "L":
		continue
	elif s1 == "U":
		continue
	elif s1 == "D":
		continue
	else:
		print("No")
		exit()

for s2 in S2:
	if s2 == "R":
		continue
	elif s2 == "U":
		continue
	elif s2 == "D":
		continue
	else:
		print("No")
		exit()
		
print("Yes")

Submission status: Accepted

Solution code:
odd = list('RUD')
evn = list('LUD')
S = list(input())

flag = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] in odd:
            pass
        else:
            flag = False
            break
    else:
        if S[i] in evn:
            pass
        else:
            flag = False
            break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input()
s=len(a)
f=False
for i,s in enumerate(a):
    if i%2==0 and s=='L':
        print("No")
        f=True
        break
    if i%2!=0 and s=='R':
        print("No")
        f=True
        break
if not f:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()

# print(S)

flag = True
for i in range(len(S)):
    # print(S[i])
    
    if (i + 1) % 2 == 1:
        if not (S[i] == 'R' or S[i] == 'U' or S[i] == 'D'):
            flag = False
    else:
        if not(S[i] == 'L' or S[i] == 'U' or S[i] == 'D'):
            flag = False
            
            
# print(flag)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
A = 'RUD'; B = 'LUD'
ok = 1
for i, c in enumerate(S):
    if i % 2 == 0:
        if A.find(c) == -1:
            ok = 0
    else:
        if B.find(c) == -1:
            ok = 0
print("Yes" if ok else "No")

Submission status: Accepted

Solution code:
S = input()

ans = "Yes"
for i, s in enumerate(S):
    if (i+1) %2 == 1:
        if s == 'R' or s == 'U' or s == 'D':
            pass
        else:
            ans = 'No'
            #print(i, s, ans)
            break
    else:
        if s == 'L' or s == 'U' or s == 'D':
            pass
        else:
            ans = 'No'

            break
print(ans)

Submission status: Accepted

Solution code:

N = input()
steps = [i for i in N]
N = len(N)
ans = "Yes"
for i in range(0,N,2):
    if steps[i] == "L":
        ans = "No"
for i in range(1,N,2):
    if steps[i] == "R":
        ans = "No"
print(ans)

Submission status: Accepted

Solution code:
s = input()

l = [ _ for _ in s ]

odd = set(['R','U','D'])
even = set(['L','U','D'])

l_odd = l[::2]
l_even = l[1::2]

s_odd = set(l_odd)
s_even = set(l_even)

if s_odd.issubset(odd) and s_even.issubset(even) :
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
s=input()
test=0
i=0
n=len(s)
if n%2==0:
   while  i<n:
      if s[i]=="L":
         test+=1
      if s[i+1]=="R":
         test+=1
      i+=2
else:
   while i+1<n:
      if s[i]=="L":
         test+=1
      if s[i+1]=="R":
         test+=1
      i+=2
   else:
      if s[i]=="L":
         test+=1
if test==0:
   print("Yes")
else:
   print("No")

Submission status: Accepted

Solution code:
import sys
S = input()
S_List = list(S)

S_o = S_List[0::2]

S_e = S_List[1::2]


for i in S_o:
    if(i != 'R' and i != 'U' and i != 'D'):

        print('No')
        sys.exit()

for i in S_e:
    if(i != 'L' and i != 'U' and i != 'D'):

        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()
a = len(S)
T = 0
b = 0

if a % 2 == 0:
  b = a // 2
  for i in range(b):
    if S[2*i] == 'L':
      T += 1    
  for i in range(b):
    if S[2*i+1] == 'R':
      T += 1

else:
  b = a // 2
  for i in range(b+1):
    if S[2*i] == 'L':
      T += 1
  for i in range(b):
    if S[2*i+1] == 'R':
      T += 1  

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

countx = 0
county = 0

for x in range(0, len(S), 2):
    if S[x] != 'R' and S[x] != 'U' and S[x] != 'D':
        countx += 1
   
for y in range(1, len(S), 2):
    if S[y] != 'L' and S[y] != 'U' and S[y] != 'D':
        county += 1
        
print("Yes") if countx == 0 and county ==0 else print("No")

Submission status: Accepted

Solution code:
s = str(input())

o = ['R','U','D']
e = ['L','U','D']
flag = 0
for idx ,i in enumerate(s):
  if (idx+1)%2 == 0 and not i in e:
    print('No')
    flag = 1
    break
  if (idx+1)%2 != 0 and not i in o:
    print('No')
    flag = 1
    break
if flag == 0:
  print('Yes')

Submission status: Accepted

Solution code:
s = input()
out = "No" if any(ss not in "RUD" for ss in s[::2]) or any(ss not in "LUD" for ss in s[1::2]) else "Yes"
print(out)

Submission status: Accepted

Solution code:
a=list()
b=list()
a="R", "U","D"
b="L", "U", "D"
s=input()
count=0
ans=True
for i in s:
    if count%2==0:
        if i not in a:
            ans=False
    if count%2!=0:
        if i not in b:
            ans=False
    count+=1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
s = list(S)

result = True

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
s = input()
if len(s) == 1:
    if s == "L":
        print("No")
    else:
        print("Yes")
else:
    for i in range(len(s)//2):
        if s[i*2] == "L" or s[1+i*2] == "R":
            print("No")
            break
    else:
        print("Yes")

Submission status: Accepted

Solution code:
S = input()

# 奇数番目の文字を抽出
extract1 = S[::2]
#print(extract1)
odd = extract1.find("L")


# 偶数番目の文字を抽出
extract2 = S[1::2]
#print(extract2)
even = extract2.find("R")

if odd == -1 and even == -1:
    print('Yes')

else:
    print("No")

Submission status: Accepted

Solution code:
n = list(input())
n.insert(0, 0)
if n.count("U") + n.count("D") == len(n):
    print("Yes")
else:
    count_l = 0
    count_r = 0
    for i in range(1, len(n)):
        if i % 2 == 0:
            if n[i] == 'R':
                count_r += 1
        if i % 2 != 0:
            if n[i] == 'L':
                count_l += 1
    print("No") if count_r > 0 or count_l > 0 else print("Yes")

Submission status: Accepted

Solution code:
S = input()
Ls = ['L', 'U', 'D'] #偶数
Rs = ['R', 'U', 'D'] #奇数
l = len(S)
n = l//2
f = True
S = 'R' + S
for i in range(1, n + 1):
    if (S[2*i - 1] in Rs) and (S[2*i] in Ls):
        pass
    else:
        f = False
        break
if f:
    if l%2 == 1:
        if S[-1] in Rs:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#coding:utf-8

S = input()
evenstr =[S[i] for i in range(len(S)) if i % 2 == 0]
oddstr = [S[i] for i in range(len(S)) if i % 2 != 0]

for i in evenstr:
    if i in ['R','U','D']:
        jud = True
    else:
        jud = False
        break
if jud:
    for i in oddstr:
        if i in ['L','U','D']:
            jud = True
        else:
            jud = False
            break

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

Submission status: Accepted

Solution code:
T = ['L', 'R']
s = str(input())
S = [s[i:i+1] for i in range(0, len(s), 1)]

j = 0
for j in range(0, len(S)-1, 2):
    if (S[j] == T[0]) or (S[j+1] == T[1]):
        print('No')
        exit()
if (len(S) % 2 != 0) and (S[-1] == T[0]):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()
S1 = S[::2]
S2 = S[1::2]
f = 1
for i in S1:
    if i in ['R', 'U', 'D']:
        f *= 1
    else:
        f *= 0
        
for i in S2:
    if i in ['L', 'U', 'D']:
        f *= 1
    else:
        f *= 0
if f:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
cnt = 0
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for i in range(len(S)):
    if i %2==0:
        if S[i] in odd:
            cnt +=1
    elif i %2==1:
        if S[i] in even:
            cnt +=1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

S = input()
S_odd = list(S)[0::2]
S_even = list(S)[1::2]

if 'L' in S_odd or 'R' in S_even:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

res = 'Yes'

for n,i in enumerate(s):
	if n % 2 == 1:
		if i == 'R':
			res = 'No'
	else:
		if i == 'L':
			res = 'No'

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

count = 0
a = 0
b = 0
for i in range(len(S)):
    if count % 2 != 0:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            b -= 1
    else:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            a -=1

    count += 1

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

Submission status: Accepted

Solution code:
S = input()

flg = True
for i in range(len(S)):
    s = S[i]
    if (i+1) % 2 == 0:
        if s == 'R':
            flg = False
            break
    elif (i+1) % 2 == 1:
        if s == 'L':
            flg = False
            break
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
ans = 0
for i in range(len(s)):
    #print(i)
    if i %2==0:
        if s[i] == 'L':
            #print('g')
            ans = 1
    if i %2==1:
        if s[i]== 'R':
            #print('k')
            ans=1

if ans ==1:
    print('No')
if ans == 0:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = True

# 偶数
for a in set(S[1::2]):
    if a == "R":
        flag = False
        break 
    
# 奇数
for b in set(S[::2]):
    if b == "L":
        flag = False
        break
        
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = str(input())
n = len(S)
sgn = [0]*n
for i in range(n):
    if (i%2) == 1:
        if S[i] == "L" or S[i] == "U" or S[i] == "D":
            sgn[i] = 0
        else:
            sgn[i] = 1
    if (i%2) == 0:
        if S[i] == "R" or S[i] == "U" or S[i] == "D":
            sgn[i] = 0
        else:
            sgn[i] = 1
if sum(sgn) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = str(input())

#list_S_even =  [ c for c in S  if S.index(c)%2==1 ]
#list_S_odd =  [ c for c in S  if S.index(c)%2==0 ]

list_S_even = [c for c in S[1::2]]
list_S_odd =  [c for c in S[::2]]

#print(list_S_even)
#print(list_S_odd)

judge_aaa = True

for i in list_S_even:
    if i == "L" or i == "U" or i == "D":
        pass
    else:
        judge_aaa = False

for i in list_S_odd:
    if i == "R" or i == "U" or i == "D":
        pass
    else:
        judge_aaa = False

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

Submission status: Accepted

Solution code:
S = input()

Frag_1 = True
Frag_2 = True
for a in range(len(S)):
    if a % 2 == 0:

        if S[a] == "R" or S[a] =="U" or S[a] == "D":
            continue
        else:
            Frag_1 = False
    
    elif S[a] == "L" or S[a] =="U" or S[a] == "D":
        continue
    else:
        Frag_2 = False

if Frag_2 == True and Frag_1 == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
td = input()
o = td[::2]   # rud
e = td[1::2]    # lud
if "L" in o or "R" in e:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

print(flag)

Submission status: Accepted

Solution code:
S = input()
output="Yes"
time=0
for step in S:
  time+=1
  if time%2==1 and step=="L":
    output=("No")
  elif time%2==0 and step=="R":
    output=("No")  
print(output)

Submission status: Accepted

Solution code:
S = str(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 s in odd:
    if s == 'L':
        ans = 'No'
for s in Even:
    if s == 'R':
        ans = 'No'
print(ans)

Submission status: Accepted

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

S = input()
if S[0::2].find('L') == -1 and S[1::2].find('R') == -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
str = input()
f = True
for s in str[0::2]:
    if s == "L":
       f = False
       break

if f == False:
    print("No")
    sys.exit()

for s in str[1::2]:
    if s == "R":
        f = False
        break

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

Submission status: Accepted

Solution code:
S = str(input())
ans="Yes"
for i, str in enumerate(S):
    if (i+1)%2==1:#奇数の時
        if not str=="R" and not str=="U" and not str=="D":
            ans="No"
    elif (i+1)%2==0:
        if not str=="L" and not str=="U" and not str=="D":
            ans="No"
print(ans)

Submission status: Accepted

Solution code:
s = input()
l=len(s)
flag = 1
#print(s)
for i in range(l):
    if i%2==0:####i
        if s[i] =='L':
            flag =0
            #rint(i,s[i])

    elif i%2==1:
        if s[i] =="R" :
            flag = 0
            #rint(i,s[i])

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