N, Q = [int(x) for x in input().split()]
s = input()
t_d = [input().split() for _ in range(Q)]
state = [1] * N
for spell in t_d:
    if spell[1] == "L":
        for j in range(N):
            if s[j] == spell[0] and state[j] != 0:
                tmp = state[j]
                state[j] = 0
                if j != 0:
                    state[j-1] += tmp
    elif spell[1] == "R":
        for j in range(N):
            if s[N-j-1] == spell[0] and state[N-j-1] != 0:
                tmp = state[N-j-1]
                state[N-j-1] = 0
                if j != 0:
                    state[N-j] += tmp
print(sum(state))
