N,Q=map(int,input().split(' '))
S=input()
field=[1]*N #ゴーレム数
fieldmap={} #どのアルファベットのマスがどこにあるか
for i in range(65,65+26):
	fieldmap[chr(i)] = []
for i in range(N):
	fieldmap[S[i]].append(i)
for i in range(Q):
	t,d=input().split(' ')
	if fieldmap[t]!=[]:
		if d=='L':
			for place in sorted(fieldmap[t]):
				if place!=0:
					field[place-1] += field[place]
				field[place]=0					
		elif d=='R':
			for place in sorted(fieldmap[t])[::-1]:
				if place!=N-1:
					field[place+1] += field[place]
				field[place]=0
print(sum(field))