using System;
using System.Collections.Generic;
using System.Linq;

namespace ExaWizC {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var q = input[1];
            var s = Console.ReadLine();
            var res = Enumerable.Repeat(1,n).ToArray();
            var keys = new SortedDictionary<char, List<int>>();

            for (int i = 0; i < q; i++) {
                var x = Console.ReadLine();
                var t = x[0];
                if (!keys.ContainsKey(t)) {
                    keys.Add(t,new List<int>());
                    var index = 0;
                    while (true) {
                        index = s.IndexOf(t,index);
                        if (index == -1) break;
                        keys[t].Add(index);
                        index++;
                    }
                }

                var d = x[2];
                foreach (var index in keys[t]) {
                    if (d == 'L') {
                        if (index != 0) res[index - 1] += res[index];
                    } else {
                        if (index < n-1) res[index + 1] += res[index];
                    }
                    res[index] = 0;
                }
            }
            Console.WriteLine(res.Sum());
        }
    }
}