n, q = map(int, input().split())
masses = input()
mass_map = {}
for mass in masses:
    mass_map[mass] = [i for i, x in enumerate(masses) if x == mass]
spells = [tuple(tuple(input().split())) for spell in range(q)]

golems = [1] * (n + 2)
for spell in spells:
    if spell[0] not in mass_map:
        continue
    indexes = mass_map[spell[0]]
    direction = spell[1]
    for index in indexes:
        index += 1
        if direction == 'L':
            golems[index - 1] += golems[index]
        elif direction == 'R':
            golems[index + 1] += golems[index]
        golems[index] = 0

golems[0] = golems[-1] = 0
print(sum(golems))
