You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
523 B
25 lines
523 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 110;
|
|
char a[N];
|
|
int n;
|
|
int c0, c1, c2;
|
|
/*
|
|
6
|
|
p q p p q q
|
|
*/
|
|
int main() {
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) cin >> a[i];
|
|
// p右 q左 0,1,2
|
|
for (int i = 1; i <= n; i++) {
|
|
int cnt = 0;
|
|
if (a[i - 1] == 'p') cnt++;
|
|
if (a[i + 1] == 'q') cnt++;
|
|
if (cnt == 0) c0++;
|
|
if (cnt == 1) c1++;
|
|
if (cnt == 2) c2++;
|
|
}
|
|
cout << c0 << " " << c1 << " " << c2 << endl;
|
|
return 0;
|
|
} |