N,Q = (int(x) for x in input().split())
s = list(input())
area = [[] for i in range(26)]
for i in range(N):
    area[ord(s[i])-65].append(i+1)

golem = [1 for i in range(N+2)]
for i in range(Q):
    t,d = input().split()
    if d == 'R':
        for j in area[ord(t)-65][::-1]:
            golem[j+1] += golem[j]
            golem[j] = 0
    else:
        for j in area[ord(t)-65]:
            golem[j-1] += golem[j]
            golem[j] = 0

print(N+2 - golem[0] - golem[N+1])