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

import sys

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        lines.append(input())
        tokens = lines[0].split(" ")
        n = int(tokens[0])
        q = int(tokens[1])
        lines.append(input())
        for i in range(q):
            lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        print("lines=%s" % lines)
        tokens = lines[0].split(" ")
        n = int(tokens[0])
        q = int(tokens[1])

    s = lines[1]

    t = []
    d = []
    for i in range(q):
        tokens = lines[i+2].split(" ")
        t.append(tokens[0])
        d.append(tokens[1])

    return (n, q, s, t, d)

def solve(n, q, s, t, d):

    gm = dict()
    for i, c in enumerate(s):
        gl = gm.get(c, [])
        gl.append(i)
        gm[c] = gl


    # for g_cat, gl in gm.items():
    #     for g_pos in gl:
    #         w = " " * g_pos
    #         print("%s%s" % (w, g_cat))
    for i in range(q):
 
        # print("i=%d-------------------------" % i )
        tt = t[i]
        dd = d[i]
        
        if tt in gm:
            gl = gm[tt]
            if dd == "L":
                gm[tt] = [g_pos - 1 for g_pos in gl if 0 <= g_pos - 1]
            else:
                gm[tt] = [g_pos + 1 for g_pos in gl if g_pos + 1 < n]

        # print("t[%d]=%s, d[%d]=%s" % (i,tt,i,dd))
        # for g_cat, gl in gm.items():
        #     for g_pos in gl:
        #         w = " " * g_pos
        #         print("%s%s" % (w, g_cat))

        # print("i=%d-------------------------" % i )
    
    result = 0
    for gl in gm.values():
        result = result + len(gl)

    return result



def main():

    print("%d" % solve(*parse_input()))

if __name__ == '__main__':

    main()
