N, Q = map(int, input().strip().split())
#print(N, Q)
s = input().strip()
#print(s)
s = '*' + s + '*'
#print(s)
spells = []
for i in range(Q):
    spells.append(list(map(str, input().strip().split())))
#print(spells)
S = []
for i in s:
    S.append([i, 1])
#print(S)
#print()
for i in spells:
    #print(i)
    for j in range(1, len(S)):
        if i[0] == S[j][0] and i[1] == 'L':
            if S[j][1] > 0:
                S[j - 1][1] += S[j][1]
                S[j][1] = 0
        elif i[0] == S[len(S) - 1 - j][0] and i[1] == 'R':
            if S[len(S) - 1 - j][1] > 0:
                S[len(S) - 1 - j + 1][1] += S[len(S) - 1 - j][1]
                S[len(S) - 1 - j][1] = 0
    #print(S)
    #print()
#print(S)
total = 0
for i in range(1, len(S) - 1):
    total += S[i][1]
#print()
print(total)

