N,M=map(int,input().split())
b = input()
k = [[]*26]
s = [0]+[1]*N+[0]
from collections import defaultdict as ddict
d = ddict(lambda: [])
for i,t in enumerate(b):
  d[t].append(i+1)
for i in range(M):
  ta,tb=map(str,input().split())
  r = 1 if tb == "R" else -1
  for j in d[ta]:
    s[j+r] += s[j]
    s[j]   -= s[j]
print(N-s[-1]-s[0])
    

  

