import numpy as np
N, Q = map(int, input().split())
# 文字の中身
a = input()
A = np.array([a[i: i + 1] for i in range(N)])
# ゴーレムの位置を保存
Golem = np.zeros(N)
for j in range(N):
    Golem[j] += j

for k in range(Q):
    t, d = input().split()
    for m in range(N):
        if (t == A[m]):
            for n in range(N):
                if Golem[n] == m:
                    if Golem[n] == -1:
                        continue
                    if d == "R":
                        if Golem[n] == N - 1:
                            Golem[n] = -1
                        else:
                            Golem[n] += 1
                    else:
                        Golem[n] -= 1
print("{}".format(N - np.sum(Golem == -1)))
