n,q = map(int,input().split())
s = input()
t = [0]*q
d = [0]*q
g_in_box = [1]*(n+2)
answer = 0
box_name = {}

for i in range(n):
    box_name[0]  = 0
    box_name[i+1] = s[i]
    box_name[n+1] = 0

for i in range(q):
    t[i],d[i] = input().split()

    if d[i] == "R":

        for j in range(n):
            
            if box_name[j+1] == t[i]:

                if g_in_box[j+1] > 0:
                    g_in_box[j+2] += g_in_box[j+1]
                    g_in_box[j+1] -= g_in_box[j+1]

    else:
        for j in range(n):
            
            if box_name[j+1] == t[i]:

                if g_in_box[j+1] > 0:
                    g_in_box[j] += g_in_box[j+1]
                    g_in_box[j+1] -= g_in_box[j+1]

for i in range(n):
    answer += g_in_box[i+1]

print(answer)