AtCoder Beginner Contest 141 - Tap Dance

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-----
RUDLUDR

-----Sample Output-----
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.

Source: atcoder | Difficulty: EASY


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


S = input()
So = S[0::2]
Se = S[1::2]
if 'L' in So:
	print('No')
elif 'R' in Se:
	print('No')
else:
	print('Yes')


step = input()
s = list(step)
odd_list = s[0::2]
even_list = s[1::2]
if 'L' in odd_list or 'R' in even_list:
	print('No')
else:
	print('Yes')


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


S = str(input())
answer = 'Yes'
for i in range(len(S)):
	j = i + 1
	if j % 2 == 0:
		if S[i] == 'R':
			answer = 'No'
	elif S[i] == 'L':
		answer = 'No'
print(answer)


S = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for x in range(len(S)):
	if (x + 1) % 2 == 0:
		if not S[x] in even:
			print('No')
			break
	elif not S[x] in odd:
		print('No')
		break
else:
	print('Yes')


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


s = list(input())
for i in s[::2]:
	if i == 'L':
		print('No')
		return
for j in s[1::2]:
	if j == 'R':
		print('No')
		return
print('Yes')


s = input()
print('Yes' if s[::2].count('L') + s[1::2].count('R') == 0 else 'No')


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


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


s = input()
print('Yes' if all((c in 'RUD' for c in s[::2])) and all((c in 'LUD' for c in s[1::2])) else 'No')


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


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


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


S = input()
Odd = ['R', 'U', 'D']
Even = ['L', 'U', 'D']
S_l = len(S)
result = 'Yes'
for i in range(0, S_l):
	if i % 2 == 0:
		if not S[i] in Odd:
			result = 'No'
			break
	if i % 2 != 0:
		if not S[i] in Even:
			result = 'No'
			break
print(result)


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


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


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


S = str(input())
flag = True
for i in range(len(S)):
	if i % 2 == 0 and S[i] == 'L':
		flag = False
	elif i % 2 != 0 and S[i] == 'R':
		flag = False
if flag:
	print('Yes')
else:
	print('No')


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


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


s = open(0).read()
if 'L' not in s[::2] and 'R' not in s[1::2]:
	print('Yes')
else:
	print('No')


s = input()
howmany = len(s)
judge = 'Yes'
for x in range(howmany):
	if x % 2 == 0:
		if s[x] != 'R' and s[x] != 'U' and (s[x] != 'D'):
			judge = 'No'
			break
	elif s[x] != 'L' and s[x] != 'U' and (s[x] != 'D'):
		judge = 'No'
		break
print(judge)


S = input()
even = []
odd = []
for i in range(len(S)):
	if i % 2 == 0:
		even.append(S[i])
	else:
		odd.append(S[i])
if 'L' not in even and 'R' not in odd:
	print('Yes')
else:
	print('No')


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


S = str(input())
ans = 0
for i in range(len(S)):
	if i % 2 == 1:
		if S[i] == 'R':
			print('No')
			return
	elif S[i] == 'L':
		print('No')
		return
print('Yes')


def __starting_point():
	S = list(input())
	chk = True
	for i in range(len(S)):
		if i % 2 == 1:
			if S[i] == 'R':
				chk = False
				break
		elif S[i] == 'L':
			chk = False
			break
	if chk:
		print('Yes')
	else:
		print('No')
__starting_point()


s = input()
odd_s = list(s[0::2])
even_s = list(s[1::2])
to = ['R', 'U', 'D']
te = ['L', 'U', 'D']
if set(odd_s).issubset(to) and set(even_s).issubset(te):
	print('Yes')
else:
	print('No')


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


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


import re
if re.match('^([RUD][LUD])*[RUD]?$', input()):
	print('Yes')
else:
	print('No')


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


S = input()
print('YNeos'['L' in S[0::2] or 'R' in S[1::2]::2])


for (i, s) in enumerate(input(), start=1):
	if i % 2 == 0:
		if s == 'R':
			print('No')
			return
	elif s == 'L':
		print('No')
		return
print('Yes')


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


N = str(input())
a = ['R', 'U', 'D']
b = ['L', 'U', 'D']
c = 0
for i in range(0, len(N)):
	if i % 2 == 0:
		if N[i] in a:
			c += 1
	elif N[i] in b:
		c += 1
if c == len(N):
	print('Yes')
else:
	print('No')


import re
string = input()
pattern = re.compile('^([^L][^R])*[^L]?$')
if pattern.match(string):
	print('Yes')
else:
	print('No')


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


S = input()

def ans141(S: str):
	judge = 0
	for i in range(0, len(S)):
		if (i + 1) % 2 == 1:
			if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
				continue
			else:
				judge += 1
		elif (i + 1) % 2 == 0:
			if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
				continue
			else:
				judge += 1
	if judge > 0:
		return 'No'
	else:
		return 'Yes'
print(ans141(S))


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


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


s = [c for c in input()]
result = 'Yes'
for (index, step) in enumerate(s, start=1):
	if index % 2 == 1:
		if step not in 'RUD':
			result = 'No'
			break
	elif step not in 'LUD':
		result = 'No'
		break
print(result)


import re
s = input()
p = re.compile('^([^L][^R])*[^L]?$')
if p.match(s):
	print('Yes')
else:
	print('No')


S = input()
cnt = 0
for i in range(0, len(S)):
	if i % 2 == 0:
		if S[i] in ['R', 'U', 'D']:
			cnt += 1
	elif S[i] in ['L', 'U', 'D']:
		cnt += 1
if cnt == len(S):
	print('Yes')
else:
	print('No')


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


S = input()
if set(S[::2]) - set('RUD') == set(S[1::2]) - set('LUD') == set():
	print('Yes')
else:
	print('No')


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


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


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


s = input()
check = True
for i in range(len(s)):
	if i % 2 == 0 and s[i] not in ['R', 'U', 'D']:
		check = False
	elif i % 2 == 1 and s[i] not in ['L', 'U', 'D']:
		check = False
print('Yes' if check else 'No')


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


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


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


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


S = input()
point = 0
l = len(S)
i = 0
while i < l:
	if int(i % 2) == 1:
		if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
			point += 1
	elif S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
		point += 1
	i += 1
if point == l:
	print('Yes')
else:
	print('No')


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


s = input()
for (i, si) in enumerate(s):
	if si in ['U', 'D']:
		continue
	if i % 2 == 1 and si == 'L':
		continue
	if i % 2 == 0 and si == 'R':
		continue
	print('No')
	return
print('Yes')


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


import re
s = input()
print('Yes' if re.fullmatch('[RUD]*', s[::2]) and re.fullmatch('[LUD]*', s[1::2]) else 'No')


S = input()
odd_step = list(S[0::2])
even_step = list(S[1::2])
if 'R' not in even_step and 'L' not in odd_step:
	print('Yes')
else:
	print('No')


s = input().rstrip()
s1 = s[::2]
s2 = s[1::2]
if 'L' in s1 or 'R' in s2:
	print('No')
else:
	print('Yes')


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


s = input()
print(['Yes', 'No']['L' in s[::2] or 'R' in s[1::2]])


S = list(input())
ans = True
for i in range(len(S)):
	if i % 2 != 0:
		if S[i] != 'L' and S[i] != 'U' and (S[i] != 'D'):
			ans = False
	elif S[i] != 'R' and S[i] != 'U' and (S[i] != 'D'):
		ans = False
if ans:
	print('Yes')
else:
	print('No')


word = input()
odd_v = ['R', 'U', 'D']
odd_list = []
even_v = ['L', 'U', 'D']
even_list = []
for (index, i) in enumerate(word, 1):
	if index % 2 == 1:
		odd_list.append(i)
	else:
		even_list.append(i)
if set(odd_list).issubset(odd_v) and set(even_list).issubset(even_v):
	print('Yes')
else:
	print('No')


S = str(input())
even_list = list(S)
odd_list = []
n = 0
for i in even_list:
	add_odd = even_list.pop(n)
	odd_list.append(add_odd)
	n += 1
if 'R' in even_list:
	print('No')
elif 'L' in odd_list:
	print('No')
else:
	print('Yes')


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


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


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


S = input()
kisu = ['R', 'U', 'D']
gusu = ['L', 'U', 'D']
for i in range(len(S)):
	if (i + 1) % 2 == 0 and S[i] in gusu:
		continue
	elif (i + 1) % 2 != 0 and S[i] in kisu:
		continue
	else:
		print('No')
		return
print('Yes')


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


s = input()
o = s[::2]
e = s[1::2]
ans = 'Yes' if 'L' not in o and 'R' not in e else 'No'
print(ans)


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


import re
S = input()
print('NYoe s'[len(re.sub('[RUD]', '', S[0::2])) == 0 == len(re.sub('[LUD]', '', S[1::2]))::2])


string = input()
main = []
for (index, char) in enumerate(string):
	if (index + 1) % 2 == 1:
		if char not in 'RUD':
			main.append('No')
	elif char not in 'LUD':
		main.append('No')
main.append('Yes')
print(main[0])


s = input()
odds = ['R', 'U', 'D']
evens = ['L', 'U', 'D']
for i in range(len(s)):
	if i % 2 != 0:
		if s[i] not in evens:
			ans = 'No'
			break
	elif s[i] not in odds:
		ans = 'No'
		break
else:
	ans = 'Yes'
print(ans)


import re
S = input()
print('Yes' if re.fullmatch('([RUD][LUD])*[RUD]?', S) else 'No')


s = input()
print('YNeos'[not (s[0::2].find('L') == -1 and s[1::2].find('R') == -1)::2])


import sys
s = list(input())
if 'L' not in s[::2] and 'R' not in s[1::2]:
	print('Yes')
else:
	print('No')


Ss = input().rstrip()
if 'L' not in Ss[::2] and 'R' not in Ss[1::2]:
	print('Yes')
else:
	print('No')


print(['No', 'Yes'][all([a in ('RUD', 'LUD')[i % 2] for (i, a) in enumerate(input())])])


s = input()
ans = True
for c in s[0::2]:
	if c not in {'R', 'U', 'D'}:
		ans = False
		break
for c in s[1::2]:
	if c not in {'L', 'U', 'D'}:
		ans = False
		break
if ans:
	print('Yes')
else:
	print('No')


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


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


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


s = input()
print('Yes' if all((s[i] in 'LUD' if i & 1 else s[i] in 'RUD' for i in range(len(s)))) else 'No')


S = str(input())
odd = list(S[0::2])
even = list(S[1::2])
if all([n == 'R' or n == 'U' or n == 'D' for n in odd]) and all([n == 'L' or n == 'U' or n == 'D' for n in even]):
	print('Yes')
else:
	print('No')


S = input()
flag = True
for (i, value) in enumerate(S):
	if i % 2 == 1:
		if value == 'R':
			flag = False
	elif value == 'L':
		flag = False
if flag:
	print('Yes')
else:
	print('No')


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


s = input()
a = s[::2]
b = s[1::2]
ans = 0
if not 'L' in a and (not 'R' in b):
	print('Yes')
else:
	print('No')


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


s = list(input())
kisu = s[::2]
gusu = s[1::2]
flag = 0
for e in kisu:
	if e == 'R' or e == 'U' or e == 'D':
		flag += 1
for e in gusu:
	if e == 'L' or e == 'U' or e == 'D':
		flag += 1
if flag == len(s):
	print('Yes')
else:
	print('No')


s = input()
s = list(s)
odd_list = s[0::2]
even_list = s[1::2]
if 'R' not in even_list and 'L' not in odd_list:
	print('Yes')
else:
	print('No')


S = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
ans = 'Yes'
for (i, s) in enumerate(S):
	if i % 2 == 0 and s not in odd:
		ans = 'No'
		break
	elif i % 2 == 1 and s not in even:
		ans = 'No'
		break
print(ans)


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


def answer(s: str) -> str:
	for (i, c) in enumerate(s):
		if i % 2 == 0:
			if c == 'L':
				return 'No'
		elif c == 'R':
			return 'No'
	return 'Yes'

def main():
	s = input()
	print(answer(s))

def __starting_point():
	main()
__starting_point()


import re
a = input()
b = re.compile('^([^L][^R])*[^L]?$')
if b.match(a):
	print('Yes')
else:
	print('No')


S = input()
print(('Yes', 'No')['L' in S[::2] or 'R' in S[1::2]])


S = input()
print(('Yes', 'No')[S[::2].find('L') >= 0 or S[1::2].find('R') >= 0])


s = input()
a = s[0::2]
b = s[1::2]
print('Yes' if a.count('L') == 0 and b.count('R') == 0 else 'No')


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


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


S = input()
l = len(S)
yes = True
for i in range(l):
	if i % 2:
		if S[i] == 'R':
			yes = False
	elif S[i] == 'L':
		yes = False
if yes:
	print('Yes')
else:
	print('No')


s = input()
odd = s[0::2]
even = s[1::2]
print(['Yes', 'No']['L' in odd or 'R' in even])


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


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


s = input()
print(' YNeos'[set(s[::2]) <= set('RUD') and set(s[1::2]) <= set('LUD')::2])


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


s = input()
o = ['R', 'U', 'D']
e = ['L', 'U', 'D']
ans = 'Yes'
for i in range(len(s)):
	if i % 2 == 0:
		if s[i] not in o:
			ans = 'No'
	elif s[i] not in e:
		ans = 'No'
print(ans)


s = input()
ans = 1
for i in range(len(s)):
	if i + 1 & 1:
		if s[i] not in 'RUD':
			ans = 0
	elif s[i] not in 'LUD':
		ans = 0
print('Yes' if ans == 1 else 'No')


def resolve():
	s = input()
	step_odd = 'RUD'
	step_even = 'LUD'
	ans = 'Yes'
	for (i, j) in enumerate(s):
		if i % 2 == 0 and j not in step_odd:
			ans = 'No'
		elif i % 2 != 0 and j not in step_even:
			ans = 'No'
		else:
			pass
	print(ans)
resolve()


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


s = input()
s1 = s[0::2]
s2 = s[1::2]
if s1.count('L') == 0 and s2.count('R') == 0:
	print('Yes')
else:
	print('No')


s = [i for i in input()]
s_len = len(s)
list1 = []
list2 = []
for j in range(0, s_len, 2):
	for even in s[j]:
		list1.append(even in ['R', 'U', 'D'])
for k in range(1, s_len, 2):
	for odd in s[k]:
		list2.append(odd in ['L', 'U', 'D'])
if False in list1:
	print('No')
elif False in list2:
	print('No')
else:
	print('Yes')


S = input()
F = 'LR'
for (i, s) in enumerate(S):
	if s == F[i % 2]:
		print('No')
		break
else:
	print('Yes')


S = list(input())
A = S[::2]
B = S[1::2]
if 'L' in A:
	print('No')
elif 'R' in B:
	print('No')
else:
	print('Yes')


list_s = list(input())
for i in range(0, len(list_s)):
	if list_s[i] == 'U' or list_s[i] == 'D':
		continue
	elif i % 2 == 0 and list_s[i] == 'R' or (i % 2 != 0 and list_s[i] == 'L'):
		continue
	else:
		print('No')
	return
print('Yes')


print(['No', 'Yes'][[(i[::2].count('L') == 0) & (i[1::2].count('R') == 0) for i in [input()]][0]])


s = input()
s1 = set(s[::2]) - set('RUD')
s2 = set(s[1::2]) - set('LUD')
if s1 or s2:
	print('No')
else:
	print('Yes')


s = input()
L = ['R', 'U', 'D']
M = ['L', 'U', 'D']
lens = len(s)
cnt = 0
for i in range(lens):
	if (i + 1) % 2 == 1 and s[i] in L:
		cnt += 1
	elif (i + 1) % 2 == 0 and s[i] in M:
		cnt += 1
if cnt == lens:
	print('Yes')
else:
	print('No')


S = input()
s_odd = S[::2]
s_even = S[1::2]

def is_valid_str(s_list, valid_strs):
	for s in s_list:
		if s not in valid_strs:
			return False
	return True
even_ok = is_valid_str(s_even, ['L', 'U', 'D'])
odd_ok = is_valid_str(s_odd, ['R', 'U', 'D'])
if even_ok and odd_ok:
	print('Yes')
else:
	print('No')


s = input()
n = len(s)
res = 'Yes'
for i in range(n):
	if i % 2 == 0:
		if s[i] == 'L':
			res = 'No'
	elif s[i] == 'R':
		res = 'No'
print(res)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
s = insr()
for i in range(0, len(s), 2):
	if s[i] == 'L':
		print('No')
		return
for i in range(1, len(s), 2):
	if s[i] == 'R':
		print('No')
		return
print('Yes')


S = input()
a = {'R', 'U', 'D'}
b = {'L', 'U', 'D'}
Odd = set(S[0::2])
Even = set(S[1::2])
if Even <= b and Odd <= a:
	print('Yes')
else:
	print('No')


s = input()
ans = 'Yes'
for i in range(len(s)):
	if (i + 1) % 2 == 1:
		if s[i] not in ['R', 'U', 'D']:
			ans = 'No'
			break
	elif s[i] not in ['L', 'U', 'D']:
		ans = 'No'
		break
print(ans)


s = input()
t = 0
if any([i == 'R' for i in s[1::2]]) or any([i == 'L' for i in s[::2]]):
	t = 1
print('YNeos'[t::2])


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


print('Yes' if 0 == sum([i % 2 == 0 and s == 'L' or (i % 2 == 1 and s == 'R') for (i, s) in enumerate(input())]) else 'No')


S = input()
judge = True
for n in range(len(S)):
	if n % 2 == 0:
		if S[n] not in ['R', 'U', 'D']:
			judge = False
			break
	elif S[n] not in ['L', 'U', 'D']:
		judge = False
		break
if judge:
	print('Yes')
else:
	print('No')


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


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


def abc(s):
	a = 0
	for i in range(0, len(s), 2):
		if s[i] == 'L':
			a += 1
	for j in range(1, len(s), 2):
		if s[j] == 'R':
			a += 1
	if a == 0:
		return 'Yes'
	else:
		return 'No'
print(abc(input()))


s = input()
a = s[::2]
b = s[1::2]
if a.find('L') != -1 or b.find('R') != -1:
	print('No')
else:
	print('Yes')


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


S = list(input())

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


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


s = str(input())
a = 0
b = 0
for i in range(len(s)):
	if i % 2 == 0:
		if 'L' in s[i]:
			a += 1
for i in range(len(s)):
	if i % 2 != 0:
		if 'R' in s[i]:
			b += 1
if a > 0 or b > 0:
	print('No')
else:
	print('Yes')


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


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


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


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


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


s = list(input())
b = 0
if 'L' in s[::2]:
	print('No')
elif 'R' in s[1::2]:
	print('No')
else:
	print('Yes')


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)


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


l = list(input())
o = l[0::2]
e = l[1::2]
if 'L' in o or 'R' in e:
	print('No')
else:
	print('Yes')


s = input()
print('YNeos'[sum((1 for c in s[::2] if c in 'RUD')) + sum((1 for c in s[1::2] if c in 'LUD')) < len(s)::2])