N, Q = map(int, input().split())
s = input()
td = [list(input().split()) for _ in range(Q)]
golem = [1 for _ in range(N)]
cnt = 0
for tidi in td:
  for i in range(N):
    if tidi[1] == "R":
      if s[i] == tidi[0]:
        if i == N - 1:
          cnt += golem[i]
        else:
          golem[i + 1] += golem[i]
        golem[i] = 0
    else:
      if s[i] == tidi[0]:
        if i == 0:
          cnt += golem[i]
        else:
          golem[i - 1] += golem[i]
        golem[i] = 0

print(N - cnt)