n, q = map(int, input().split())
s = input()
a = [[x for x in input().split()] for _ in range(q)]
g = [1] * n
for j in a:#呪文
    #print(g)
    masu = -1
    for i in s:#マス
        masu += 1
        if i != j[0]:
            continue
        if  j[1] == "R":
            if masu == n-1:
                g[n-1] = 0
            else:
                g[masu+1] += g[masu]
                g[masu] = 0
        else:#L
            if masu == 0:
                g[0] = 0
            else:
                g[masu-1] += g[masu]
                g[masu] = 0
                
print(sum(g))
                
        
        