alpha2num = lambda c: ord(c) - ord('A')

n=input()
q=n.split(' ')[1]
n=n.split(' ')[0]
s=input()
t=[]
d=[]
for i in range(int(q)):
	t2=input()
	d2=t2.split(' ')[1]
	t2=t2.split(' ')[0]
	t.append(alpha2num(t2))
	if(d2=='L'):
		d.append(True)
	else:
		d.append(False)

diction={0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [], 13: [], 14: [], 15: [], 16: [], 17: [], 18: [], 19: [], 20: [], 21: [], 22: [], 23: [], 24: [], 25: []}

temp=0
now=[]

for i in range(len(s)):
	now.append(1)

for i in s:
	i=alpha2num(i)
	diction[i].append(temp)
	temp+=1

ans=int(n)


for i in range(int(q)):
	dictional=diction[t[i]]
	if(not d[i]):
		dictional.sort()
		dictional.reverse()
	for j in dictional:
		if(d[i]==True and j==0):
			ans=ans-now[j]
			now[j]-=now[j]
		elif(d[i]==False and j==len(s)-1):
			ans=ans-now[j]
			now[j]-=now[j]
		else:
			if(d[i]):
				now[j-1]+=now[j]
				now[j]-=now[j]
			else:
				now[j+1]+=now[j]
				now[j]-=now[j]

print(ans)