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 s[nl] == i[0]:
      L.append(i[0])
      nl += 1
    if len(R) == 0:
      continue
    if R[-1] == i[0]:
      R.pop()
      nr += 1
  else:
    if s[nr] == i[0]:
      R.append(i[0])
      nr -= 1
    if len(L) == 0:
      continue
    if L[-1] == i[0]:
      L.pop()
      nl -= 1

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