import sys
import copy

def solve():
    N,Q=map(int,input().split())
    s=list(input())
    s2={}
    for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
        s2[i]=[]
    for i,c in enumerate(s):
        s2[c].append(i+1)
    r2=copy.copy(s2)
    for k in r2.keys():
        r2[k]=list(reversed(r2[k]))

    m=[1 for i in range(N+2)]
    m[0]=0
    m[N+1]=0

    #print()
    #print(s2)
    #print(r2)
    #print(0,0,s)
    #print(0,0,m)
    for i in range(Q):
        t,d=sys.stdin.readline().rstrip().split()
        if d=='L':
            for i in s2[t]:
                m[i-1]+=m[i]
                m[i]=0
        else:
            for i in r2[t]:
                m[i+1]+=m[i]
                m[i]=0
        #print(t,d,m)
    return N-m[0]-m[N+1]

print(solve())
