# -*- coding: utf-8 -*-
N, Q = map(int, input().split())
s = input().strip()

golems = [[c, 1] for c in s]
for i in range(Q):
  floor, direction = input().strip().split()
  if direction == 'L':
    for i in range(0, N):
      if golems[i][0] == floor:
        if i > 0:
	        golems[i - 1][1] += golems[i][1]
        golems[i][1] = 0
  elif direction == 'R':
    for i in range(N - 1, -1, -1):
      if golems[i][0] == floor:
        if i < N - 1:
        	golems[i + 1][1] += golems[i][1]
        golems[i][1] = 0 

print(sum([golem[1] for golem in golems]))
