using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exw3
{
    class mas
    {
        public char moji;
        public int G;
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] nqs = Console.ReadLine().Split(' ');
            int N = int.Parse(nqs[0]);
            int Q = int.Parse(nqs[1]);

            string s = Console.ReadLine();

            List<mas> masl = new List<mas>();

            for (int i = 0; i < N; i++)
            {
                mas m = new mas();
                m.moji = s[i];
                m.G = 1;
                masl.Add(m);

            }

            List<string> sl = new List<string>();

            for (int i = 0; i < Q; i++)
            {
                string qs = Console.ReadLine();
                sl.Add(qs);
            }

            int ind = 0;
            for(; ; )
            {
                bool rm = false;

                if(ind+1 >= sl.Count)
                {
                    break;
                }
                if (sl[ind][0] == sl[ind+1][0])
                {
                    if(sl[ind][2] == 'L')
                    {
                        if (sl[ind + 1][2] == 'R' && sl[ind][0] != s[0])
                        {
                            sl.RemoveAt(ind);
                            sl.RemoveAt(ind);
                            rm = true;
                        }
                    }
                    else
                    {
                        if (sl[ind + 1][2] == 'L' && sl[ind][0] != s[N-1])
                        {
                            sl.RemoveAt(ind);
                            sl.RemoveAt(ind);
                            rm = true;
                        }

                    }
                }

                if(rm == false)
                {
                    ind++;
                }
            }

            for (int i = 0; i < sl.Count; i++)
            {
                string qs = sl[i];
                int res = 0;
                for (; ; )
                {
                    res = masl.FindIndex(res, m => m.moji == qs[0]);
                    if(res < 0)
                    {
                        break;
                    }
                    if(qs[2] == 'L')
                    {
                        if(res != 0)
                        {
                            masl[res - 1].G += masl[res].G;
                        }
                    }
                    else
                    {
                        if(res != N - 1)
                        {
                            masl[res + 1].G += masl[res].G;
                        }
                    }
                    masl[res].G = 0;

                    res++;
                }
            }

            int Gc = 0;
            for(int i = 0; i < masl.Count; i++)
            {
                Gc += masl[i].G;
            }

            Console.WriteLine(Gc);
        }
    }
}
