# coding: utf-8
import sys
import numpy as np

input = sys.stdin.readline

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

tile = {} # 文字マップ
now = np.array([1] * (N+2))

for s in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
  tile.setdefault(s, [])

for i in range(len(S)):
  tile[S[i]].append(i+1)

for i in range(Q):
  t, d = input().split()
  old = now[tile[t]]
  if d == "L":
    now[(np.array(tile[t])-1).tolist()] += old
    now[tile[t]] -= old
  else:
    now[(np.array(tile[t])+1).tolist()] += old
    now[tile[t]] -= old

#print(now)
print(sum(now) - now[0] - now[-1])