Files
python/TangDou/LanQiaoBei/LanQiaoBei13GuoSai/1.cpp

25 lines
523 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}