
class human():

	def __init__(self, position, max_position):
		self.position = position
		self.alive = True
		self.max_position = max_position - 1

	def move(self, left):
		
		if left == "L":
			self.position -= 1
		else:
			self.position += 1

		if self.position < 0:
			self.alive = False
		elif self.position > self.max_position:
			self.alive = False

N, Q = map(int, input().split())
s = list(input())
uniq_s = sorted(list(set(s)))
humans = {}
positions = {}

for i in uniq_s:
	positions[i] = []

for i, char in enumerate(s):
	humans[i] = i
	positions[char].append(i)
print(humans.values())
for _ in range(Q):
	t, d = map(str, input().split())
	if d == "L":
		vol = -1
	else:
		vol = 1
	if t in uniq_s:
		target_position = positions[t]
		keys = [k for k, v in humans.items() if v in target_position]
		for key in keys:
			humans[key] = humans[key] + vol
		print(humans.values())
	else:
		continue
				
count = 0

for i in humans.values():
	if i < 0 or i > N - 1:
		break
	else:
		count += 1


print(count)