N, Q = map(int, input().split())
s = list(input())
golem = [1 for i in range(N)]


for i in range(Q):
    t, d = input().split()
    for j in range(N):
        if s[j] == t:
            if golem[j] >= 1:
                golem[j] -= 1
            if (j == N - 1 and d == "R") or (j == 0 and d == "L"):
                continue
            else:
                if d == "R":
                    golem[j + 1] += 1
                else:
                    golem[j - 1] += 1

print(sum(golem))