N,Q = map(int,input().split())
s = input()
td = []
for i in range(Q):
    td.append(list(input().split()))

count = 0
for i in range(N):
    l = i+1
    r = N-i
    for q in range(Q):
        if min(l,r)>(Q-q) or min(l,r)==0:
            break
        if td[q][0]==s[l-1]:
            if td[q][1]=='R':
                l += 1
                r -= 1
            else:
                l -= 1
                r += 1
    if min(l,r)>0:
        count += 1
print(count)