using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{


    public static void Main(string[] argc)
    {
        int N, Q;
        var split = Console.ReadLine().Split().Select(int.Parse).ToArray();
        N = split[0];
        Q = split[1];
        string S = Console.ReadLine();
        Stack<magic> magicstack = new Stack<magic>();
        for (int i = 0; i < Q; i++)
        {
            var stringsplit = Console.ReadLine().Split();
            magic magic = new magic(stringsplit[0], stringsplit[1]);
            magicstack.Push(magic);

        }

        masu[] field = new masu[N + 2];
        for (int i = 0; i < N; i++)
        {
            field[i + 1] = new masu(i + 1, ""+S[i]);

        }

        int hidari = 1;
        int migi = N;

        while (magicstack.Count > 0)
        {
            magic thismagic = magicstack.Pop();
            if (thismagic.direction == "R")
            {
                //一番右を見る。
                if (field[migi].t == thismagic.letter)
                {
                    field[migi].save = false;
                    migi--;
                }

            }
            else
            {
                if (field[hidari].t == thismagic.letter)
                {
                    field[hidari].save = false;
                    hidari++;
                }
            }

        }
        Console.WriteLine(migi - hidari+1);
        ;


    }
    struct masu
    {
        public string t;
        public bool save;
        public int index;
        public masu(int i,string t)
        {
            this.index = i;
            this.t = t;
            save = true;

        }
    }

    struct magic
    {
        public string letter;
        public string direction;

        public magic(string l, string d)
        {
            this.letter = l;
            this.direction = d;

        }

    }
}