# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def atoi(c):
	return ord(c)-65
	
def cc(l, d):
	di = 1 if d == 'R' else -1
	l[0]+=di
	l[1] = l[0] if l[0]>l[1] else l[1]
	l[2] = l[0] if l[0]<l[2] else l[2]



def main(io):
	n,q = map(int, io().split())
	s=io()[:n]
	
	rr=[[ii for ii, c in enumerate(s) if atoi(c)==i] for i in range(27)]
	
	l=[1 for _ in s]
	for _ in range(q):
		t,d=io().split()
		dd=1 if d=='R' else -1
		for mm in rr[atoi(t)][::dd]:
			if mm+dd >=0 and mm+dd <n:
				l[mm+dd]+=l[mm]
			l[mm]=0
	
	return sum(l)

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))