N, Q = map(int, input().split())
l = input()
golem = [0]+ [1 for i in range(N)] + [0]
for i in range(Q):
    t, d = input().split()
    if(d == "R"): move = +1
    else: move = -1
    for j in range(N):
        if(l[j] == t):
            golem[j+1+move] += golem[j+1]
            golem[j+1] = 0
print(N - golem[0] - golem[-1])