N,Q = map(int,input().split()) #Nマス Q呪文回数
s = input()
g_num = [1 for i in range(N)]

def sposi(t):
    s_list = []
    s_size = len(s)
    for ss in range(s_size):
        if s[ss]==t:
            s_list.append(ss)
    return s_list
  
for q in range(Q):
    t,d = map(str,input().split())
    s_posi = sposi(t)
    for k in s_posi:
      	if g_num[k]!=0:
            if k==0 and d=='L':
                g_num[k]=0
            elif (k==N-1 or k==-1) and d=='R':
                g_num[k]=0
            elif d=='L':
                g_num[k]=0
                g_num[k-1]+=g_num[k]
            elif d=='R':
                g_num[k]=0
                g_num[k+1]+=g_num[k]

golem = 0
for i in range(len(g_num)):
    golem+= g_num[i]
print(golem)