output_description: Print the resulting string.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S T
attempt: n, k = [int(x) for x in input().split(" ")]
  s, p, r = [int(x) for x in input().split(" ")]
  texts = list(input())
  
  
  def can_key(i, key):
      if i - k >= 0:
          if last_h[i - k] != key:
              return True
          return False
      return True
  
  
  score = 0
  last_h = []
  for i, text in enumerate(texts):
      if text == "r":
          if can_key(i, r):
              score += r
              last_h.append(r)
          else:
              # score += s
              last_h.append(s)
  
      elif text == "s":
          if can_key(i, s):
              score += s
              last_h.append(s)
          else:
              # score += p
              last_h.append(p)
  
      elif text == "p":
          if can_key(i, p):
              score += p
              last_h.append(p)
          else:
              # score += r
              last_h.append(r)
  print(score)
  
problem_description: Statement
  
  Given are two strings S and T consisting of lowercase English letters.
  Concatenate T and S in this order, without space in between, and print the
  resulting string.
samples: [{"input": "oder atc", "output": "atcoder\n    \n\nWhen S =  `oder` and T =  `atc`, concatenating T and S in this order results\nin `atcoder`.\n\n* * *"}, {"input": "humu humu", "output": "humuhumu"}]