#!/usr/bin/env python3

import numpy as np


N, Q = [int(x) for x in input().split(" ")]
s = input()

ngorem = np.ones(N, dtype=np.int16)
char_ms = {}
for i, _s in enumerate(s):
    if _s not in char_ms:
        char_ms[_s] = []
    char_ms[_s].append(i)


for _ in range(Q):
    ti, di = input().split(" ")
    if ti in char_ms:
        for src in char_ms[ti]:
            dst = src + 1 if di == "R" else src - 1
            ng = ngorem[src]
            ngorem[src] = 0
            if 0 <= dst < N:
                ngorem[dst] += ng

print(np.sum(ngorem))