def remove(S):
	S.append

a = []
b = []
N = map(int,raw_input().split())
c = raw_input()
mem = 0
mode = 0
temp = 0
k = 0
for i in range(26):
	b.append(list())
for ch in c:
	li = b[ord(ch) - 65]
	li.append(k)
	k = k + 1
for i in range(N[0]):
	a.append(1)
for i in range(N[1]):
	k = 0
	td = raw_input().split()
	if(td[1] == 'L'):
		mode = 0
	else:
		mode = 1
	if mode == 0:
		for i2 in b[ord(td[0]) - 65]:
			if i2 == 0:
				a[0] = 0
			else:
				a[i2-1] += a[i2]
				a[i2] = 0
	else:
		for i2 in reversed(b[ord(td[0]) - 65]):
			if i2 == N[0] - 1:
				a[i2] = 0
			else:				
				a[i2 + 1] += a[i2]
				a[i2] = 0
print(sum(a))