n,q = map(int, raw_input().split())
import collections
cc = collections.defaultdict(list)

for i,l in enumerate(raw_input()): 
	cc[l].append(i)
r = [1 for _ in range(n)]
delta = collections.Counter()
for _ in range(q):
	letter,direction = raw_input().split()
	if direction == 'L':
		for u in cc[letter]:
			if u - 1 >= 0:
				r[u - 1] += r[u]
			r[u] = 0

	elif direction == 'R':
		for u in cc[letter][::-1]:
			if u + 1 < n:
				r[u + 1] += r[u]
			r[u] = 0

print sum(r)