from collections import defaultdict
class Cell:
    def __init__(self, value, prev):
        self.value = value
        self.next_cell = None
        self.prev_cell = prev

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

s_dict = defaultdict(list)
prev_cell = None
for elem in s:
    new_cell = Cell(1, prev_cell)
    if prev_cell is not None:
        prev_cell.next_cell = new_cell
    s_dict[elem].append(new_cell)
    prev_cell = new_cell

for q in range(Q):
    t, d = map(str, input().split())
    for elem in s_dict[t]:
        if d == 'R':
            if elem.next_cell is not None:
                elem.next_cell.value += elem.value
            else:
                N -= elem.value
        if d == 'L':
            if elem.prev_cell is not None:
                elem.prev_cell.value += elem.value
            else:
                N -= elem.value
        elem.value = 0

print(N)
