# your code goes here

n, q = list(map(int, input().split(" ")))
s = input()
ans = [1 for i in range(n)]
m = {}
for i in range(len(s)):
	if s[i] in m:
		m[s[i]].append(i)
	else:
		m[s[i]] = [i]


for i in range(q):
	t, d = input().split(" ")
	if not t in m:
		continue
	if d == "L":
		for j in m[t]:
			if j == 0:
				ans[j] = 0
			else:
				ans[j-1] += ans[j]
				ans[j] = 0
	else:
		for j in m[t][::-1]:
			if j == n-1:
				ans[j] = 0
			else:
				ans[j+1] += ans[j]
				ans[j] = 0
				
print(sum(ans))
