# -*- coding: utf-8 -*-

nq = input().split()
s = input()
td = []
for i in range(int(nq[1])):
    td.append(input().split())
print(td)

g_list = []
for i in range(int(nq[0])):
    g_list.append(1)

for i in range(0, int(nq[1])):
    for j in range(0, int(nq[0])):
        if td[i][0] == s[j]:
            g_list[j] = 0
            if td[i][1] == 'R':
                if j != int(nq[0]) -1:
                    g_list[j+1] = 1
            else:
                if j != 0:
                    g_list[j-1] = 1

print(g_list.count(1))