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

S = input()
for i in range(Q):
    t1, d1 = input().split()
    for i, g in enumerate(golem):
        if (g is not -1) and (g is not N):
            if S[g] == t1:
                if d1 is 'L':
                    golem[i] -= 1
                elif d1 is 'R':
                    golem[i] += 1

print('{}'.format((N-golem.count(-1))-(golem.count(N))))