from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


# inputs
N, Q = 0, 0
S = ""
T, D = [], []


def set_inputs():
    global N, Q, S, T, D
    N, Q = get_li()
    S = get_str()
    T, D = get_data(Q, [str, str])
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    array = [1] * N
    indices = defaultdict(list)
    for i, s in enumerate(S):
        indices[s].append(i)
    for t, d in zip(T, D):
        for i in indices[t]:
            golem = array[i]
            array[i] = 0
            if d == "L" and i != 0:
                array[i-1] += golem
            elif d == "R" and i != N - 1:
                array[i+1] += golem
    print(sum(array))
    return


if __name__ == '__main__':
    main()
