N,Q=map(int,input().split())
s=input()
M=[1]*N;x=[]

def FIND:
  n=0
  for char in s:
    if char==t:
      x.append(n)
    n+=1

for _ in range(Q):
  t,u=map(int,input().split())
  FIND()
  n=0
  for i in str(len(x)):
    if x[int(i)]=='0' and u=='L':
      M[0]=0
    elif x[int(i)]==len(s) and u=='R':
      M[len(s)-1]=0
    elif u=='L':
      M[int(x[int(i)])-1]=int(M[int(x[int(i)])])+M[int(x[int(i)])-1]
      M[int(x[int(i)])]=0
    elif u=='R':
      M[int(x[int(i)])+1]=int(M[int(x[int(i)])])+M[int(x[int(i)])+1]
      M[int(x[int(i)])]=0
  #この辺ミスる(確信)

print(sum(M))