import Control.Monad
import Data.Vector (Vector(..), fromList, (!))

data Result = LeftVanished | Alive | RightVanished

main :: IO ()
main = do
  [n, q] <- map read . words <$> getLine
  s <- fromList <$> getLine
  tds <- replicateM q ((\[(x:_), (y:_)] -> [x, y]) . words <$> getLine)
  print $ solve n s tds

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: Int -> Vector Char -> [[Char]] -> Int
solve n s tds = aliveEnd - aliveBegin + 1
  where
    aliveBegin = go_b 0 n
    aliveEnd   = go_e 0 n

    go_b begin end
      | end - begin <= 1 = end
      | otherwise        = let center = (end + begin) `div` 2 in
        case result n s tds center of
          LeftVanished -> go_b center end
          _            -> go_b begin center

    go_e begin end
      | end - begin <= 1 = end
      | otherwise        = let center = (end + begin) `div` 2 in
        case result n s tds center of
          RightVanished -> go_b begin center
          _             -> go_b center end

result :: Int -> Vector Char -> [[Char]] -> Int -> Result
result _ _ []          _       = Alive
result n s ([t,d]:tds) i
  | (s ! i) /= t             = result n s tds i
  | d == 'L' && i == 0       = LeftVanished
  | d == 'L' && i >  0       = result n s tds (i - 1)
  | d == 'R' && i == (n - 1) = RightVanished
  | d == 'R' && i <  (n - 1) = result n s tds (i + 1)
