N ,Q= map(int,input().split())
s = str(input())
s =list( " " + s + " ")
road = [1]*(N+2)
road[0] = -1
road[-1] = -1
ans = N
for q in range(Q):
    t ,d= map(str,input().split())
    idxes = [i for i in range(len(s)) if s[i] == t]
    if d == "R":
        if road[-2] >= 1 and s[-2] == t:
            ans -=road[-2]
        for idx in idxes:
            if s[idx] == t:
                road[idx+1] += road[idx]
                road[idx] = 0  
    if d == "L":
        if road[1] >= 1 and s[1] == t:
            ans -= road[1]
        for idx in idxes:
            if s[idx] == t:
                road[idx-1] += road[idx]
                road[idx] = 0  
print(ans)