import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
h = logging.FileHandler("logtest.log")
logger.addHandler(h)

N, Q = list(map(int, input().split()))

# ゴーレムのいる位置
# 同じマスに複数いる可能性もあり
s_1 = list(map(str, input()))
s = [[i] for i in s_1]

for i in range(Q):
    # t: name, d: L or R
    t, d = list(map(str, input().split()))
    logger.info("i: {}, t: {}, d: {}".format(i, t, d))
    logger.info("before_s: {}".format(s))

    # tのindex
    t_id_list = []
    for i in range(len(s)):
        if t in s[i]:
            t_id_list.append(i)
    t_id_list = list(set(t_id_list))

    logger.info("t_id_list: {}".format(t_id_list))

    # move
    for t_id in t_id_list:
        logger.info("t_id: {}".format(t_id))
        logger.info("s_now: {}".format(s))

        # 対象のゴーレムtを全て消去する
        for i in range(len(s[t_id])):
            try:
                if s[t_id][i] == t:
                    s[t_id].remove(t)
            except:
                pass
        logger.info("s_remove: {}".format(s))

        if d == "L" and t_id - 1 >= 0:
            s[t_id - 1].append(t)
        elif d == "R" and t_id + 1 <= N:
            s[t_id + 1].append(t)

        logger.info("after_s: {}\n".format(s))

    logger.info("after_s: {}\n".format(s))

cnt = 0
for i in range(len(s)):
    for j in range(len(s[i])):
        if s[i][j] != "":
            cnt += 1
print(cnt)

