import sys

n, q = map(int, input().split())
s = input()
commands = [line.rstrip().split() for line in sys.stdin]
commands.reverse()
lim_l, lim_r = 0, n - 1
ans = 0
for t, d in commands:
    if d == 'L':
        if t == s[lim_l]:
            ans += 1
            lim_l += 1
        elif lim_r < n - 1 and t == s[lim_r + 1]:
            ans -= 1
            lim_r += 1
    else:
        if t == s[lim_r]:
            ans += 1
            lim_r -= 1
        elif lim_l > 0 and t == s[lim_l - 1]:
            ans -= 1
            lim_l -= 1
    # print(t, d, lim_l, lim_r, ans)
print(n - ans)
