import numpy as np

nq=input().split()
N=int(nq[0])
Q=int(nq[1])
arr=np.ones(N+2)
lr_dic={}
s=input()
lr={'L':-1,'R':1}
for i in range(N):
    if not(s[i] in lr_dic):
        lr_dic[s[i]]=np.zeros(N)
    lr_dic[s[i]][i]=1

for i in range(Q):
    line = input().split()
    if not line[0] in lr_dic:
        continue
    masked = arr[1:N+1]*lr_dic[line[0]]
    plus=np.zeros(N+2)
    minus=np.zeros(N+2)
    #print(masked)
    minus[1:N+1]=masked
    if line[1]=='L':
        plus[:N] = masked
    else:
        plus[2:] = masked
    arr = arr + plus - minus
    


print(int(sum(arr[1:N+1])))