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

class AtCoder
{
    const int MOD = 1000000007;
    public void Slove()
    {
        var inputs = Console.ReadLine().Split();
        int n = int.Parse(inputs[0]);
        int q = int.Parse(inputs[1]);
        var pos =
            Enumerable.Range(0, 26)
            .Select(x => new List<int>())
            .ToArray();
        foreach(var item in Console.ReadLine().Select((Value, Index) => new {Value, Index}))
        {
            pos[item.Value - 'A'].Add(item.Index);
        }
        int[] dp = Enumerable.Repeat(1, n).ToArray();
        foreach(int i in Enumerable.Range(0, q))
        {
            inputs = Console.ReadLine().Split();
            if(inputs[1] == "L")
                foreach(int j in pos[inputs[0][0] - 'A'])
                {
                    if(j != 0)
                        dp[j - 1] += dp[j];
                    dp[j] = 0;
                }
            else
                foreach(int j in pos[inputs[0][0] - 'A'])
                {
                    if(j != n - 1)
                        dp[j + 1] += dp[j];
                    dp[j] = 0;
                }
        }
        System.Console.WriteLine(dp.Sum());
    }
    static void Main()
    {
        var ac = new AtCoder();
        ac.Slove();
    }
}