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

spells = []
for i in range(Q):
    spell = input().split()
    spells.append(spell)

vanish_point = []
output = []
for i, spell in enumerate(spells):
    if s[0] == spell[0] and spell[1] == 'L':
        vanish_point.append((i, 0))
    if s[-1] == spell[0] and spell[1] == 'R':
        vanish_point.append((i, len(s) - 1))
for point in vanish_point:
    if point[0] == 0:
        output.append((point[1]))
        continue

    for i in range(point[0])[::-1]:
        spell = spells[i]
        if spell[0] == s[point[1]]:
            break
        if point[1] + 1 < len(s) and spell[0] == s[point[1] + 1] and spell[1] == 'L':
            vanish_point.append((i, point[1] + 1))
        if 0 <= point[1] - 1 and spell[0] == s[point[1] - 1] and spell[1] == 'R':
            vanish_point.append((i, point[1] - 1))
        if i == 0:
            output.append((point[1]))

# pprint(vanish_point)
# print(output)
print(len(s) - len(output))
