# your code goes here

n, q = list(map(int, input().split(" ")))
s = input()
ans = [[s[i]] for i in range(n)]
print(ans)

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