N, Q = map(int,input().split())
s = input()
li = [1] * N
dic = {}
for c in s:
    if c not in dic.keys():
        dic[c] = [i for i, x in enumerate(s) if x == c]
for i in range(Q):
    t, d = input().split()
    print([i for i in dic[t] if li[i]!=0])
    for num in [i for i in dic[t] if li[i]!=0]:
        tmp = li[num]
        li[num] = 0
        if d == 'L':
            if num - 1 >= 0:
                li[num - 1] += tmp
        else:
            if num + 1 < N:
                li[num + 1] += tmp
print(sum(li))