a = list(map(int,input().split()))
N = a[0]
Q = a[1]
golem = [1 for i in range(N)] #各マスにいるゴーレムの個数
alp = [[] for i in range(26)] #A-Zの座標

s = input()
for i in range(N):
    alp[ord(s[i])-65].append(i)
for i in range(Q):
    cmd = list(input().split())
    moji = ord(cmd[0])-65
    if cmd[1] == "R":
        # alp[ord(cmd[0])-65]に格納されている値+1
        for item in alp[moji]:
            if item < N-1:
                golem[item+1] += golem[item]
            golem[item] = 0
    else:
        for item in alp[moji]:
            if item > 0:
                golem[item-1] += golem[item]
            golem[item] = 0
print(sum(golem))
#計算量O(N+Q*N/26)