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

namespace exawizards2019C
{
    class Program
    {
        static void Main(string[] args)
        {
            var inp = Console.ReadLine().Split(' ').Select(int.Parse);
            var N = inp.First();
            var Q = inp.Last();

            var s = Console.ReadLine();
            var g = Enumerable.Repeat(1, N).ToArray();
            var dict = new Dictionary<char, List<int>>();
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            var cnt = 0;

            foreach (var c in chars)
            {
                dict.Add(c, new List<int>());
            }

            foreach (var c in s)
            {
                dict[c].Add(cnt++);
            }

            for (int i = 0; i < Q; i++)
            {
                var input = Console.ReadLine();
                var t = input[0];
                var d = input[2];
                foreach (var cell in dict[t])
                {
                    if (d == 'L')
                    {
                        if (cell != 0)
                        {
                            g[cell - 1] += g[cell];
                        }
                    }
                    else
                    {
                        if (cell != N - 1)
                        {
                            g[cell + 1] += g[cell];
                        }
                    }
                    g[cell] = 0;
                }
            }

            Console.WriteLine(g.Sum());
        }
    }
}
