//============================================================================
// Name : 1c-pun.cpp
// Author : poz
// Version :
// Description : https://sio2.mimuw.edu.pl/c/pa-2022-1/p/pun/
//============================================================================
#include <bits/stdc++.h>
using namespace std;
int main() {
const int C = 10;
int count;
int result = 0;
int n;
cin >> n;
string s;
cin >> s;
const int L = n / C;
int i = 0;
for (int g = 0; g < C; g++) {
count = 0;
for (int t = 0; t < L; t++) {
if (s[i] == 'T') {
count++;
}
i++;
}
if (count == L) {
result++;
}
}
cout << result;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | //============================================================================ // Name : 1c-pun.cpp // Author : poz // Version : // Description : https://sio2.mimuw.edu.pl/c/pa-2022-1/p/pun/ //============================================================================ #include <bits/stdc++.h> using namespace std; int main() { const int C = 10; int count; int result = 0; int n; cin >> n; string s; cin >> s; const int L = n / C; int i = 0; for (int g = 0; g < C; g++) { count = 0; for (int t = 0; t < L; t++) { if (s[i] == 'T') { count++; } i++; } if (count == L) { result++; } } cout << result; return 0; } |
English