n, q = map(int, input().split())
s = input()
lis = [1 for i in range(n)]
a = [[] for i in range(26)]
for i in range(n):
    a[ord(s[i]) - ord('A')].append(i)
ans = n
for i in range(q):
    t, d = map(str, input().split())
    if d == 'L':
        for j in a[ord(t) - ord('A')]:
            if j == 0:
                ans -= lis[j]
            else:
                lis[j - 1] += lis[j]
            lis[j] = 0
    elif d == 'R':
        for j in a[ord(t) - ord('A')]:
            if j == n-1:
                ans -= lis[j]
            else:
                lis[j + 1] += lis[j]
            lis[j] = 0

print(ans)