N,Q=map(int, input().split())
s=list(input())
box=[1]*(N+2)
for _ in range(Q):
    k=1
    t,d=map(str, input().split())
    for j in s:
        if t == j:
            if box[k] > 0:
                if d =='L':
                    box[k-1]+=box[k]
                    box[k]=0
                else:
                    box[k+1]+=box[k]
                    box[k]=0
        k+=1
    print(box)
print(sum(box[1:N+1]))