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

print(ans)