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

td.reverse()
left = 0
right = N - 1
d = {}

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

print(right - left + 1)
