import sys
input = sys.stdin.readline

N, Q = list(map(int, input().split()))
s = input()

P = [[] for i in range(26)]

alpha2num = lambda c: ord(c) - ord('A')

for i in range(N):
    P[alpha2num(s[i])].append(i)

G = [1] * N


def ans(N, Q, s):
    for i in range(Q):
        t, d = input().split()
        if d == "L":
            for j in P[alpha2num(t)]:
                if j > 0:
                    G[j-1] += G[j]
                G[j] = 0
        else:
            for j in (reversed(P[alpha2num(t)])):
                if j < N-1:
                    G[j+1] += G[j]
                G[j] = 0
    print(sum(G))


ans(N, Q, s)