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

td.reverse()

nl = 0
nr = N - 1
L = []
R = []
for i in td:
  if i[1] == "L":
    if nl < N:
      if s[nl] == i[0]:
        L.append(i[0])
        nl += 1
    if len(R) != 0:
      if R[-1] == i[0]:
        R.pop()
        nr += 1
  else:
    if nr >= 0:
      if s[nr] == i[0]:
        R.append(i[0])
        nr -= 1
    if len(L) != 0:
      if L[-1] == i[0]:
        L.pop()
        nl -= 1

print(N - len(L) - len(R))