n,q = map(int, input().split())
s = list(input())
g = [1] * (n+2)
t = []
d = []
for i in range(q):
	td = input().split()
	t.append(td[0])
	d.append(td[1])

for i in range(q):
	for j in range(n):
		if s[j] == t[i]:
			if d[i] == 'L':
				g[j] += g[j+1]
			else:
				g[j+2] += g[j+1]
			g[j+1] = 0
			g[0] = 0
			g[-1] = 0
	print(g)
				

print(sum(g))