Language: C

#include <stdio.h>
#include <string.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:21:16: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   21 |     if(strcmp(t[i],"r")==0){
      |               ~^~~
      |                |
      |                char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:22:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   22 |       if(strcmp(t[i-k],"r")==0){
      |                 ~^~~~~
      |                  |
      |                  char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:27:22: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   27 |     }else if(strcmp(t[i],"s")==0){
      |                     ~^~~
      |                      |
      |                      char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:28:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   28 |       if(strcmp(t[i-k],"s")==0){
      |                 ~^~~~~
      |                  |
      |                  char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:33:22: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   33 |     }else if(strcmp(t[i],"p")==0){
      |                     ~^~~
      |                      |
      |                      char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:34:18: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   34 |       if(strcmp(t[i-k],"p")==0){
      |                 ~^~~~~
      |                  |
      |                  char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:41:18: error: 'rb' undeclared (first use in this function); did you mean 'rn'?
   41 |   printf("%ld",r*rb+s*sn+p*pn);
      |                  ^~
      |                  rn
main.c:41:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:46:5: error: conflicting types for 'count'; have 'int(char,  char,  int)'
   46 | int count(char a,char b,int n){
      |     ^~~~~
main.c:4:5: note: previous declaration of 'count' with type 'int(char *, char *, int)'
    4 | int count(char *a,char *b,int n);
      |     ^~~~~
main.c: In function 'count':
main.c:48:18: error: expected ')' before numeric constant
   48 |   for(i=0;i<n;i++0){
      |      ~           ^
      |                  )
main.c:49:16: error: subscripted value is neither array nor pointer nor vector
   49 |     if(strcmp(a[i],b)==0)
      |                ^
main.c:49:20: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   49 |     if(strcmp(a[i],b)==0)
      |                    ^
      |                    |
      |                    char
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~