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

for i in range(Q):
  t, d = input().split()
  if d == 'R':
    for i in [i for i, x in enumerate(s) if x == t][::-1]:
      if golem[i] >= 1:
        if i != N-1:
          golem[i+1] += golem[i]
        golem[i] = 0
  else:
    for i in [i for i, x in enumerate(s) if x == t]:
      if golem[i] >= 1:
        if i != 0:
          golem[i-1] += golem[i]
        golem[i] = 0
print(sum(golem))