import sys
import copy

def solve():
    N,Q=map(int,input().split())
    s=list(map(lambda e:ord(e)-65,list(input())))
    s2=[[] for i in range(26)]
    for i,c in enumerate(s):
        s2[c].append(i+1)
    r2=copy.copy(s2)
    for i in range(26):
        r2[i]=list(reversed(r2[i]))

    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,0,-1):
        t,d=sys.stdin.readline().rstrip().split()
        t=ord(t)-65
        if d=='L':
            for j in s2[t]:
                if m[j] != 0:
                    m[j-1]+=m[j]
                    m[j]=0
            #if i & 0xff == 0:
            #    s2[t]=[e for e in s2[t] if e <= i or e >= N-i]
        else:
            for j in r2[t]:
                if m[j] != 0:
                    m[j+1]+=m[j]
                    m[j]=0
            #if i & 0xff == 0:
            #    r2[t]=[e for e in r2[t] if e <= i or e >= N-i]
        #print(t,d,m)
    return N-m[0]-m[N+1]

print(solve())
