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

from collections import defaultdict
dic = defaultdict(list)
for i in range(n):
  dic[s[i]].append(i)

for i in range(q):
  t, d = list(input().split())
  for i in range(len(dic[t])):
    e = dic[t].pop()
    if d=="R":
      e += 1
    else:
      e -= 1
    if e<0 or e>n-1:
      pass
    else:
      dic[s[e]].append(e)
    
ans = 0
for lis in dic.values():
  ans += len(lis)
print(ans)