N, Q = map(int, input().split())
S = list(input())
TD = [tuple(input().split()) for _ in range(Q)]
G = [1 for _ in range(N)]

TD_ALPHA = dict()
for i, s in enumerate(S):
	if s in TD_ALPHA:
		TD_ALPHA[s] += [i]
	else:
		TD_ALPHA[s] = [i]

for td in TD:
	if td[0] in TD_ALPHA:
		for i in TD_ALPHA[td[0]]:
			if "L" == td[1]:
				if 0 == i:
					G[i] = 0
				else:
					G[i-1] += G[i]
					G[i] = 0
			else:
				if N-1 == i:
					G[i] = 0
				else:
					G[i+1] += G[i]
					G[i] = 0
print(sum(G))
