N,Q=map(int, input().split())
s=input()
td=[input().split() for i in range(Q)]

import numpy as np

S=[np.zeros(N,dtype=np.int) for i in range(26)]
for p,c in enumerate(s):
    for i in range(26):
        if i==ord(c)-65:
            S[i][p]=1

g=np.ones(N,dtype=np.int)
for q in td:
    g_stable=g*np.logical_not(S[ord(q[0])-65])
    if q[1]=='L':
        g_move=np.append((g*S[ord(q[0])-65])[1:],0)
    else:
        g_move=np.insert((g*S[ord(q[0])-65])[:-1],0,0)
    g=g_stable+g_move
print(np.sum(g))