This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double
#define pb push_back
#define MOD 1000000007
int main (){
vector<pair<char, int>> eng;
ll a, b;
string s;
cin>>a>>b>>s;
eng.pb({s[0], 1});
for(int i = 1; i < a; i++){
if(s[i] == eng.back().first){
eng.back().second++;
if(eng.back().second == b){
eng.pop_back();
}
} else{
eng.pb({s[i], 1});
}
}
for(auto k : eng){
for(int i = 0; i < k.second; i++){
cout<<k.first;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |