N, Q = map(int, input().split())
S = ' ' + input() + ' '

ps = [0, N+1]
unvisited = [0] + [1] * N + [0]
dirs = { 'L': 1, 'R': -1 }
QS = [input().split() for _ in range(Q)]
for t, d in QS[::-1]:
  for i, p in enumerate(ps):
    np = p + dirs[d]
    print(t, d, p, np)
    if 0 <= np <= N+1 and S[np] == t:
      print(p, '->', np)
      unvisited[np] = 0
      ps[i] = np

print(sum(unvisited))