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