#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
int main(){
int n;
cin >> n;
string s;
cin >> s;
int r=0, g=0, y=0;
for(auto c:s){
if(c='r') r++;
if(c='g') g++;
if(c='y') y++;
}
if(r > n/3 or g > n/3 or y > n/3){
cout << -1;
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |