N, Q = map(int, input().split())
s = input()
td = [list( input().split()) for _ in range(Q)]

left = 0
right = N - 1
d = {}

for a in td:
    if a[1] == 'L':
        if a[0] == s[left]:
            if s[left] in d.keys():
                if d[s[left]] == -1:
                    left += 1
                elif d[s[left]] == 1:
                    d[s[left]] = -1
            else:
                d[s[left]] = -1
                left += 1
    else:
        if a[0] == s[right]:
            if s[right] in d.keys():
                if d[s[right]] == -1:
                    d[s[right]] = 1
                elif d[s[right]] == 1:
                    right -= 1
            else:
                d[s[right]] = 1
                right -= 1
    if left > right:
        break

td = td[left:right+1]

d = {}
left = 0
right = len(td) - 1

for a in td:
    if a[1] == 'L':
        if a[0] == s[left]:
            if s[left] in d.keys():
                if d[s[left]] == -1:
                    left += 1
                elif d[s[left]] == 1:
                    d[s[left]] = -1
            else:
                d[s[left]] = -1
                left += 1
    else:
        if a[0] == s[right]:
            if s[right] in d.keys():
                if d[s[right]] == -1:
                    d[s[right]] = 1
                elif d[s[right]] == 1:
                    right -= 1
            else:
                d[s[right]] = 1
                right -= 1
    if left > right:
        break



print(right - left + 1)
