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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp1 = Console.ReadLine().Split(' ');
            int N = int.Parse(imp1[0]);
            int Q = int.Parse(imp1[1]);
            int[] gorems = Enumerable.Repeat<int>(1, N).ToArray();
            var s = Console.ReadLine();
            int t = 0;
            int d = 0;
            int plsmins = 0;

            /*
            char[] s = new char[N];
            for (int k = 0; k < N; ++k)
            {
                s[k] = Console.Read();
            }
            */
            for (int i = 0; i < Q; ++i)
            {
                var read = Console.ReadLine().Split(' ');
                t = char.Parse(read[0]);
                d = char.Parse(read[1]);
                for (int j = 0; j < N; ++j)
                {
                    plsmins = gorems[j];
                    if (gorems[j] != 0 && t == s[j]) 
                    {
                        if (d == 'R')
                        {
                            gorems[j] -= plsmins;
                            if (j < N - 1)
                            {
                                gorems[j + 1] += plsmins;
                            }
                            
                        }
                        if (d == 'L')
                        {
                            gorems[j] -= plsmins;
                            if (j > 0)
                            {
                                gorems[j - 1] += plsmins;
                            }

                        }
                    }


                    
                    
                }

                /*
                for (int x = 0; x < N; ++x)
                {
                    Console.Write(gorems[x]);
                }
                */
                
            }

            Console.Write(gorems.Sum());
            //System.Threading.Thread.Sleep(2000);
        }
    }
}
