n, q = [int(item) for item in input().split()]
s = input()

box = list(s)
# print('\n', box)
for i in range(q):
    t, d = input().split()
    if d == "R":
        for j in reversed(range(n)):
            c = box[j].count(t)
            # print(c)
            box[j] = ''.join([item for item in box[j] if item != t])
            # print(box[j])
            if j < n - 1:
                box[j + 1] = box[j + 1] + t * c
    if d == "L":
        for j in range(n):
            if d == "L":
                c = box[j].count(t)
                box[j] = ''.join([item for item in box[j] if item != t])
                if j > 0:
                    box[j - 1] = box[j - 1] + t * c
    # print('t, d, box', t, d, [box[f] for f in range(n)])
count = sum([len(item) for item in box])
print(count)
