# -*- coding: utf-8 -*-

n, q = map(int, input().split())
s = input().strip()

m = {}
for i, c in enumerate(s):
    m[c] = i

for i in range(q):
    t, d = input().split()
    move = -1 if d == "L" else 1
    if t in m:
        m[t] += move
        if m[t] < 0 or m[t] >= q:
            m.pop(t)

print(len(m))
