output_description: Print the number of possible passwords.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: # run-length encoding, decoding
  def rle_encode(data):
      encoding = ""
      prev_char = ""
      count = 1
  
      if not data:
          return ""
  
      for char in data:
          # If the prev and current characters
          # don't match...
          if char != prev_char:
              # ...then add the count and character
              # to our encoding
              if prev_char:
                  encoding += str(count) + prev_char + " "
              count = 1
              prev_char = char
          else:
              # Or increment our counter
              # if the characters do match
              count += 1
      else:
          # Finish off the encoding
          encoding += str(count) + prev_char + " "
          return encoding
  
  
  N, K = [int(s) for s in input().split()]
  S = input()
  S_rle = rle_encode(S).split()
  total = 0
  for i, bunch in enumerate(S_rle):
      total += int(list(bunch)[0]) - 1
  
  if len(S_rle) >= 2 * K + 3:
      print(total + 2 * K)
  elif len(S_rle) >= 2 * K:
      print(total + 2 * K - 1)
  else:
      print(N - 1)
  
problem_description: Statement
  
  Takahashi is going to set a 3-character password.
  
  How many possible passwords are there if each of its characters must be a
  digit between 1 and N (inclusive)?
samples: [{"input": "2", "output": "8\n    \n\nThere are eight possible passwords: `111`, `112`, `121`, `122`, `211`, `212`,\n`221`, and `222`.\n\n* * *"}, {"input": "1", "output": "1\n    \n\nThere is only one possible password if you can only use one kind of character."}]