N, Q = list(map(int, input().split()))

golems = [1 for _ in range(N)]

s = input()
dic_letter = {}

for letter in set(s):
	dic_letter[letter] = []

i = 0
for mark in s:
	dic_letter[mark].append(i)
	i += 1

for _ in range(Q):
	t, d = input().split()
	if d == "R":
		for pos in dic_letter[t]:
			tmp = golems[pos]
			golems[pos] -= tmp
			if pos + 1 < N:
				golems[pos + 1] += tmp
	else:
		for pos in dic_letter[t]:
			tmp = golems[pos]
			golems[pos] -= tmp
			if pos - 1 >= 0:
				golems[pos - 1] += tmp

print(sum(golems))