nq = list(map(int, input().split()))
s = input()
number_of_golems = [1] * nq[0]
td = [input().split() for i in range(nq[1])]

for j in range(nq[1]):
    tmp_1 = [i for i, x in enumerate(s) if x == td[j][0]]
    tmp_2 = number_of_golems[:]
    for k in range(len(tmp_1)):
        if td[j][1] == "R":
            if number_of_golems[tmp_1[k]] > 0:
                tmp_2[tmp_1[k]] -= number_of_golems[tmp_1[k]]
                if tmp_1[k] == len(s) - 1:
                    pass
                else:
                    tmp_2[tmp_1[k] + 1] += number_of_golems[tmp_1[k]]
            else:
                pass
        elif td[j][1] == "L":
            if number_of_golems[tmp_1[k]] > 0:
                tmp_2[tmp_1[k]] -= number_of_golems[tmp_1[k]]
                if tmp_1[k] == 0:
                    pass
                else:
                    tmp_2[tmp_1[k] - 1] += number_of_golems[tmp_1[k]]
            else:
                pass
    number_of_golems = tmp_2[:]
print(sum(number_of_golems))