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 len(x):
    if x[i]=='0'|u=='L':
      M[0]=0
    elif x[i]==len(s)|u=='R':
      M[s-1]=0
    elif u=='L':
      M[x[i]-1]=int(M[x[i]])+M[x[i]-1]
      M[x[i]]=0
    elif u=='R':
      M[x[i]+1]=int(M[x[i]])+M[x[i]+1]
      M[x[i]]=0
  #この辺ミスる(確信)

print(sum(M))