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.append(human(i, N))
	positions[char].append(i)

for _ in range(Q):
	t, d = map(str, input().split())
	if t in uniq_s:
		target_position = positions[t]
		for human in humans:
			if human.position in target_position:
				human.move(d)
	else:
		continue
				
count = 0

for human in humans:
	if human.alive:
		count += 1

print(count)