import sys
N,Q = [int(i) for i in input().split()]
s = sys.stdin.readline()

ans = [1]*N
flg_li = []
pos_li = []
for _ in range(Q):
    t,d = [i for i in input().split()]
    if t not in flg_li:
        flg_li.append(t)
        tmp = []
        for j in range(N):
            if s[j] == t:
                tmp.append(j)
        pos_li.append(tmp)

    z = flg_li.index(t)
    if d == 'R':
        for pq in range(1,len(pos_li[z])+1):
            if ans[pos_li[z][-pq]] != 0:
                tmp_v = ans[pos_li[z][-pq]]
                ans[pos_li[z][-pq]] = 0
                if pos_li[z][-pq] != N-1:
                    ans[pos_li[z][-pq]+1] += tmp_v
    else:
        for pq in range(len(pos_li[z])):
            if ans[pos_li[z][pq]] != 0:
                tmp_v = ans[pos_li[z][pq]]
                ans[pos_li[z][pq]] = 0
                if pos_li[z][pq] != 0:
                    ans[pos_li[z][pq]-1] += tmp_v
print(sum(ans))
