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

Spell = []
for i in range(Q):
    t, d = input().split()
    Spell.append((t, d))


G_i = [i for i in range(N)]

for i in range(Q):
    S = Spell[i][0]
    for j in range(len(G_i)):
        if(not G_i[j] == None):
            if(s[G_i[j]]==S):
                if(Spell[i][1] == "L"):
                    if(not (G_i[j]-1) == -1):
                        G_i[j] = G_i[j] - 1
                    else:
                        G_i[j] = None
                if(Spell[i][1] == "R"):
                    if(not (G_i[j]+1) == N):
                        G_i[j] = G_i[j] + 1
                    else:
                        G_i[j] = None


ext = G_i.count(None)
print(N - ext)