n, q = map(int, input().split())
s = input()
l = list(s)
m = [1 for x in range(n)]
cnt = n

for x in range(q):
	t, d = input().split()
	for y in range(n):
		if l[y] == t and d == 'L':
			if y == 0:
				cnt -= m[y]
				m[y] = 0
			else:
				m[y-1] += m[y]
				m[y] = 0
		elif l[y] == t and d == 'R':
			if y == n-1:
				cnt -= m[y]
				m[y] = 0
			else:
				m[y+1] += m[y]
				m[y] = 0
		else:
			continue

print(cnt)