using System;
using System.Collections.Generic;

namespace _20190330AtCoderC
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int N = int.Parse(line[0]); //マスの数
            int Q = int.Parse(line[1]); //呪文の回数
            string[] line2 = Console.ReadLine().Split(' ');
            string s = line2[0]; //書くマスの文字列

            int sum = 0;
            List<int> GolemCount = new List<int> { };
            for (int k = 0; k < N; k++)
            {
                GolemCount.Add(1);
            }

                for (int i = 0; i < Q; i++)
            {
                string[] lineN = Console.ReadLine().Split(' '); //0はマス目、1は命令

                string MassMe = lineN[0];
                string OrderLR = lineN[1];
                

                for(int j=0;j<N;j++)
                {
                    if (MassMe[0] == s[j])
                    {
                        if (OrderLR == "L")
                        {
                            if (j == 0) {
                                GolemCount[j] = 0;
                            }
                            else { 
                                GolemCount[j - 1] += GolemCount[j];
                                GolemCount[j] = 0;
                            }
                        }
                        else
                        {
                            if (j+1 == N)
                            {
                                GolemCount[j] = 0;
                            }
                            else { 
                                GolemCount[j + 1] += GolemCount[j];
                                GolemCount[j] = 0;
                            }
                        }
                    }
                }
            }
            for(int j = 0; j < N; j++)
            {
                sum += GolemCount[j];
            }
            Console.Write(sum);
        }
        class Golem
        {
            public char GolemChar{ get; set;}
            public int GolemCount { get; set; }
            public Golem(char GolemChar,int GolemCount)
            {
                this.GolemChar = GolemChar;
                this.GolemCount = GolemCount;
            }
        }

        class Spell{
            public string str { get; set; }
            public string LR { get; set; }
            public Spell(string str,string LR) {
                this.str = str;
                this.LR = LR;
            }
        }
    }
}
