import Data.List

main :: IO ()
main = do
  k <- last . map read . words <$> getLine
  s <- getLine
  print $ solve k s

solve :: Int -> String -> Int
solve k s = go 0 k (map (\_ -> ()) $ group s) + count s
  where
    go acc 0 _ = acc
    go acc _ [_] = acc
    go acc _ [_,_] = 1 + acc
    go acc k (_:x:xs) =  go (acc + 2) (k - 1) (x:xs)

count :: String -> Int
count s = go 0 'X' s
  where
    go acc _ [] = acc
    go acc 'R' ('R':s) = go (acc + 1) 'R' s
    go acc 'L' ('L':s) = go (acc + 1) 'L' s
    go acc _ (c:s) = go acc c s
