N, Q = map(int,input().split())
s = input()
gorem = [1]*N
gorem2 = [1]*N

for i in range(Q):
    t, d = input().split()
    if d =="R":
        for j in range(N):
            if s[j] == t:
                if j == N-1:
                    gorem2[N-1] -= gorem[N-1]
                else:
                    gorem2[j+1] += gorem[j]
                    gorem2[j] -= gorem[j]                    
    elif d == "L":
        for j in range(N):
            if s[j] == t:
                if j == 0:
                    gorem2[0] -= gorem[0]
                else:
                    gorem2[j-1] += gorem[j]
                    gorem2[j] -= gorem[j]
    gorem = gorem2
    
print(sum(gorem))
