using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;


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

        var curr = new int[N];
        for (int i = 0; i < N; i++)
            curr[i] = 1;

        var mojitable = new List<int>[26];
        for (int i = 0; i < 26; i++)
            mojitable[i] = new List<int>();

        for (int i = 0; i < N; i++)
            mojitable[s[i] - 'A'].Add(i);

        for (int i = 0; i < Q; i++)
        {
            var sss = Console.ReadLine().Split();
            var mark = sss[0][0] - 'A';
            var inc = sss[1][0] == 'L' ? -1 : 1;

            foreach (var index in mojitable[mark])
            {
                var cn = curr[index];
                curr[index] = 0;
                switch (inc)
                {
                    case -1:
                        if (index > 0)
                            curr[index - 1] += cn;
                        break;
                    case 1:
                        if (index < (N - 1))
                            curr[index + 1] += cn;
                        break;
                }
            }
        }

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