Language: Java

import java.util.*;
class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner();
      	HashMap<char,char> hm = new HashMap<>();
      	char arr[] = new char[] { 'r','p','s' };
      	hm.put('r', 'p'); hm.put('p','s'); hm.put('s', 'r');
      	int n = sc.nextInt();
      	int k = sc.nextInt();
      	int r = sc.nexInt(), p = sc.nextInt(), s = sc.nextInt();
      	String comp = sc.nextLine();
      	String hum = "";
      	Integer ans = 0;
     	for (int i = 0; i < comp.length; i ++) {
          	char temp = hm[comp.charAt(i)];
 			if (i - k >= 0 && hum.charAt(i - k) != temp) {
            	hum += temp;
              	if (temp == 'r') ans += r; else if (temp == 's') ans += s;
              	else ans += p;
            }
        	else if (i - k >= 0 && hum.charAt(i - k) == temp) {
            	if (i + k < n) {
                	char temp2 = comp.charAt(i + k);
                  	for (int j = 0; j < 3; j ++){
                    	if (arr[j] != temp && arr[j] != temp2) {
                        	hum += arr[j];
                          	break;
                        }
                    }
                }
            }
          	else {
            	hum += comp.charAt(i);
            }
        }
      System.out.println(ans);
    }
}

Compiler output:
Main.java:4: error: no suitable constructor found for Scanner(no arguments)
    	Scanner sc = new Scanner();
    	             ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
Main.java:5: error: unexpected type
      	HashMap<char,char> hm = new HashMap<>();
      	        ^
  required: reference
  found:    char
Main.java:5: error: unexpected type
      	HashMap<char,char> hm = new HashMap<>();
      	             ^
  required: reference
  found:    char
Main.java:10: error: cannot find symbol
      	int r = sc.nexInt(), p = sc.nextInt(), s = sc.nextInt();
      	          ^
  symbol:   method nexInt()
  location: variable sc of type Scanner
Main.java:14: error: cannot find symbol
     	for (int i = 0; i < comp.length; i ++) {
     	                        ^
  symbol:   variable length
  location: variable comp of type String
Main.java:15: error: array required, but HashMap<<any>,<any>> found
          	char temp = hm[comp.charAt(i)];
          	              ^
6 errors