Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////

int n,k,r,s,p;
int ans=0;
string t;
cin >> n >> k;
cin >> r >> s >> p;
cin >> t;
rep(i,n){
    if(t[i]=="r"){
        if(i>=k){
            if(t[i]!=t[i-k]){
                ans+=p;
            }else{
                t[i] = "n";
            }
        }else{
            ans+=p;
        }
    }
    if(t[i]=="s"){
        if(i>=k){
            if(t[i]!=t[i-k]){
                ans+=r;
            }else{
                t[i] = "n";
            }
        }else{
            ans+=r;
        }
    }
    if(t[i]=="p"){
        if(i>=k){
            if(t[i]!=t[i-k]){
                ans+=s;
            }else{
                t[i] = "n";
            }
        }else{
            ans+=s;
        }
    }
}
fin(ans);

//////////////////////////////////////////////////////
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   57 |     if(t[i]=="r"){
a.cc:62:24: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   62 |                 t[i] = "n";
      |                        ^~~
      |                        |
      |                        const char*
a.cc:68:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   68 |     if(t[i]=="s"){
a.cc:73:24: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   73 |                 t[i] = "n";
      |                        ^~~
      |                        |
      |                        const char*
a.cc:79:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   79 |     if(t[i]=="p"){
a.cc:84:24: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   84 |                 t[i] = "n";
      |                        ^~~
      |                        |
      |                        const char*