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

t = []
d = []

for _ in range(Q):
    ti, di = map(str, input().split())
    t.append(ti)
    d.append(di)
    
spell_target = {}
for i, c in enumerate(s):
    if c in spell_target:
        spell_target[c].append(i+1)
    else:
        spell_target[c] = [i+1]
#print(spell_target)

golems_nums = [1 for _ in range(len(s) + 2)]
golems_nums[0] = 0
golems_nums[-1] = 0
#print(golems_nums)

for ti, di in zip(t, d):
    if not ti in spell_target:
        continue
    if di == 'L':
        targets = spell_target[ti]
        for n in targets:
            golems_nums[n-1] += golems_nums[n]
            golems_nums[n] = 0
    if di == 'R':
        targets = spell_target[ti]
        for n in reversed(targets):
            golems_nums[n+1] += golems_nums[n]
            golems_nums[n] = 0
#print(golems_nums)
ans = sum(golems_nums) - golems_nums[0] - golems_nums[-1]
print(ans)

