n, q = map(int,input().split())
s = list(input())

golem = [ 1 for i in range(len(s)) ]

for i in range(q):
    t, d = input().split()
    for j in range(len(golem)):
        if s[j] == t :
            if d == "L" :
                if j != 0 :
                    golem[j - 1] += golem[j]
            elif d == "R":
                if j != len(golem) - 1:
                    golem [j + 1] += golem[j]    
            golem[j] = 0

print(sum(golem))