n,q=map(int,input().split())
s=list(input())
s1=[1 for i in range(n)]
for i in range(q):
  t[i],d[i]=input().split()
for i in range(q):#回数
  if d[i]=="R":
    for j in range(n)[::-1]:#マス番号
      if t[i]==s[j]:
        if j==n:
          s[j]=0
        else:
          s[j+1]=s[j+1]+s[j]
  if d[i]=="L":
    for j in range(n):
      if t[i]==s[j]:
        if t[i]==s[j]:
        if j==0:
          s[j]=0
        else:
          s[j-1]=s[j-1]+s[j]
count=0
for i in range(n):
  count=count+s[i]
print(count)