n,q=map(int,input().split())
s=input()
wes=list(range(n+2))
for re in wes:
    wes[re]=1
for i in range(1,q+1):
    t,d=input().split()
    if d=="L":
        for p in range(n):
            if s[p]==t:
                wes[p]+=wes[p+1]
                wes[p+1]=0
    if d=="R":
        for p in range(n-1,-1,-1):
            if s[p]==t:
                wes[p+2]+=wes[p+1]
                wes[p+1]=0
res=n+2-wes[0]-wes[n+1]
print(res)