N1, Q1 = map(int, input().split())
S1 = str(input())
E1 = [[str(i) for i in input().split()] for i in range(Q1)] 
arr = [1] * N1
L1 = list(set(S1))
temp = []
dic = {}
for l in L1:
  for i in range(len(S1)):
    if l == S1[i]:
      temp.append(i)
  dic[l] = temp
  temp = []
for e in E1:
  if e[1] == 'L':
    try:
      for d in dic[e[0]]:
        if d != 0:
          arr[d-1] = arr[d-1] + arr[d]
          arr[d] = 0
        else:
          arr[0] = 0
    except KeyError:
      pass
  else:
    try:
      for d in dic[e[0]][::-1]:
        if d != N1-1:
          arr[d+1] = arr[d+1] + arr[d]
          arr[d] = 0
        else:
          arr[N1-1] = 0
    except KeyError:
      pass
print(sum(arr))