n ,q = map(int, input().split())
s = input()
string = []
for i in range(len(s)):
    string.append(s[i])
    
golem = [1 for i in range(n)]
jumon = []
direction = []

for i in range(q):
    t, d = map(str, input().split())
    jumon.append(t)
    direction.append(d)

for i in range(q): #q回呪文
    ind_t, ind_d = jumon[i], direction[i]
    index = [i for i in range(len(string))if string[i]== ind_t]
    for j in index:
        move = golem[j]
        golem[j] -=move
        if ind_d =="L" and j>=1:
            golem[j-1] += move
        elif ind_d == "R" and j<=len(string)-2:
            golem[j+1] +=move
print(sum(golem))