n, q = map(int, input().split())
s = input()

dic = {}
for i in range(len(s)):
  dic.setdefault(s[i], []).append(i)

result = [1 for i in range(n)]
  
for j in range(q):
  t, d = input().split()
  for idx in dic[t]:
    result[idx] = result[idx] - 1 if (result[idx] > 0) else 0
    if (d == 'L' and idx - 1 > 0):
      result[idx - 1] += 1
    elif (d == 'R' and idx + 1 < n):
      result[idx + 1] += 1

print(result.count(1))