N, Q = map(int,input().split())
S = input()
field = {s:[] for s in S}
golem = [1 for i in range(N)]
for i in range(N):
    field[S[i]].append(i)
del_num = 0
for i in range(Q):
    t, d = input().split()
    div = 1 if d == "R" else -1
    if not t in field:
        continue
    for f in field[t]:

        if golem[f] >0:
            if f + div >= 0 and f + div < N:
                golem[f+div] += golem[f]
            golem[f] = 0
print(sum(golem))