N,Q = map(int,input().split())
S = input()
S_list = {}
cell = [1 for i in range(N)]
for s in S:
    if s in S_list:
        continue
    else:
        index = -1
        idx_list = []
        while True:
            index = S.find(s,index+1)
            if index==-1:
                break
            idx_list.append(index)
        S_list[s] = idx_list
for i in range(Q):
    t,d = input().split()
    if t not in S_list:
        continue
    if d=='L':
        for ind in S_list[t]:
            if cell[ind]==0:
                continue
            if ind==0:
                cell[ind]=0
            else:
                cell[ind-1] += cell[ind]
                cell[ind] = 0
    else:
        for ind in reversed(S_list[t]):
            if cell[ind] == 0:
                continue
            if ind==N-1:
                cell[ind]=0
            else:
                cell[ind+1] += cell[ind]
                cell[ind] = 0
ans = sum(cell)
print(ans)
