#coding: utf-8
N, Q = map(int, input().split())
S = input()
Sl = [1 for _ in range(N)]
for i in range(Q):
    magic = list(map(str, input().split()))
    if magic[1] == "R":
        for j in range(len(S)):
            if magic[0] == S[j]:
                if j < len(Sl)-1:
                    Sl[j+1] += Sl[j]
                if Sl[j] != 0:
                    Sl[j] = 0
                
    else:
        for j in range(len(S)):
            if magic[0] == S[j]:
                if j > 0:
                    Sl[j-1] += Sl[j]
                if Sl[j] != 0:
                    Sl[j] = 0
print(sum(Sl))