N,Q = map(int, input().split())
S = input()
T = []
D = []

ord_A = ord('A')

for i in range(Q):
  t,d = input().split()
  #T.append(ord(t) - ord_A)
  T.append(t)
  D.append(d)

#P = [[] for _ in range(ord('Z') - ord('A') + 1)]
#for i in range(N):
#  p = ord(S[i]) - ord_A
#  P[p].append(i)

G = []
for i in range(Q-1,-1,-1):
  t = T[i]
  d = D[i]
  
  
  for g in G:
    #print(g[0], g[1])
    if ('L' == d):
      tmp = g[0]+1
      if (tmp < N):
        if (t == S[tmp]):
        	G.append((tmp, S[tmp]))
    elif ('R' == d):
      tmp = g[0]-1
      if (0 < tmp):
        if (t == S[tmp]):
        	G.append((tmp, S[tmp]))
  
  if ('L' == d):
    if (t == S[0]):
      G.append((0, S[0]))
  elif ('R' == d):
    if (t == S[N-1]):
      G.append((N-1, S[N-1]))
  #print(G)
  G = list(set(G))
  

print(N - len(G))
