Language: C

#include <stdio.h>

int count(char a,char b,int n);

int main(){
  int n,k;
  int r,s,p;
  int i,rn,sn,pn;
  char t[100000];
  
  scanf("%d %d",&n,&k);
  scanf("%d %d %d",&r,&s,&p);
  scanf("%s",t);
  
  rn = count(t,"r",k);
  sn = count(t,"s",k);
  pn = count(t,"p",k);
  
  for(i=k;i<n;i++){
    if(strcmp(t[i],"r")==0){
      if(strcmp(t[i-k],"r")==0){
        rn++;
      }else{
        pn++;
      }
    }else if(strcmp(t[i],"s")==0){
      if(strcmp(t[i-k],"s")==0){
        sn++;
      }else{
        rn++;
      }
    }else if(strcmp(t[i],"p")==0){
      if(strcmp(t[i-k],"p")==0){
        pn++;
      }else{
        sn++;
      }
    }
  }
  printf("%ld",r*rb+s*sn+p*pn);
    
  return 0;
}
    
int count(char a,char b,int n){
  int i,s=0;
  for(i=0;i<n;i++0){
    if(strcmp(a[i],b)==0)
      s++;
  }
  return s;
}
  
  

Compiler output:
main.c: In function 'main':
main.c:15:14: error: passing argument 1 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   15 |   rn = count(t,"r",k);
      |              ^
      |              |
      |              char *
main.c:3:16: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |           ~~~~~^
main.c:15:16: error: passing argument 2 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   15 |   rn = count(t,"r",k);
      |                ^~~
      |                |
      |                char *
main.c:3:23: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |                  ~~~~~^
main.c:16:14: error: passing argument 1 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   16 |   sn = count(t,"s",k);
      |              ^
      |              |
      |              char *
main.c:3:16: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |           ~~~~~^
main.c:16:16: error: passing argument 2 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   16 |   sn = count(t,"s",k);
      |                ^~~
      |                |
      |                char *
main.c:3:23: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |                  ~~~~~^
main.c:17:14: error: passing argument 1 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   17 |   pn = count(t,"p",k);
      |              ^
      |              |
      |              char *
main.c:3:16: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |           ~~~~~^
main.c:17:16: error: passing argument 2 of 'count' makes integer from pointer without a cast [-Wint-conversion]
   17 |   pn = count(t,"p",k);
      |                ^~~
      |                |
      |                char *
main.c:3:23: note: expected 'char' but argument is of type 'char *'
    3 | int count(char a,char b,int n);
      |                  ~~~~~^
main.c:20:8: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   20 |     if(strcmp(t[i],"r")==0){
      |        ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:20:16: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   20 |     if(strcmp(t[i],"r")==0){
      |               ~^~~
      |                |
      |                char
main.c:20:16: note: expected 'const char *' but argument is of type 'char'
main.c:21:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   21 |       if(strcmp(t[i-k],"r")==0){
      |                 ~^~~~~
      |                  |
      |                  char
main.c:21:18: note: expected 'const char *' but argument is of type 'char'
main.c:26:22: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   26 |     }else if(strcmp(t[i],"s")==0){
      |                     ~^~~
      |                      |
      |                      char
main.c:26:22: note: expected 'const char *' but argument is of type 'char'
main.c:27:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   27 |       if(strcmp(t[i-k],"s")==0){
      |                 ~^~~~~
      |                  |
      |                  char
main.c:27:18: note: expected 'const char *' but argument is of type 'char'
main.c:32:22: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   32 |     }else if(strcmp(t[i],"p")==0){
      |                     ~^~~
      |                      |
      |                      char
main.c:32:22: note: expected 'const char *' but argument is of type 'char'
main.c:33:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   33 |       if(strcmp(t[i-k],"p")==0){
      |                 ~^~~~~
      |                  |
      |                  char
main.c:33:18: note: expected 'const char *' but argument is of type 'char'
main.c:40:18: error: 'rb' undeclared (first use in this function); did you mean 'rn'?
   40 |   printf("%ld",r*rb+s*sn+p*pn);
      |                  ^~
      |                  rn
main.c:40:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'count':
main.c:47:18: error: expected ')' before numeric constant
   47 |   for(i=0;i<n;i++0){
      |      ~           ^
      |                  )
main.c:48:16: error: subscripted value is neither array nor pointer nor vector
   48 |     if(strcmp(a[i],b)==0)
      |                ^
main.c:48:20: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   48 |     if(strcmp(a[i],b)==0)
      |                    ^
      |                    |
      |                    char
main.c:48:20: note: expected 'const char *' but argument is of type 'char'