#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; i >= a; i--)
#define cat(x) cout << #x << ": " << x << endl
using namespace std;
using ll = long long;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
string s;
cin >> n >> s;
int res = 0;
rep(i, 0, 9) {
res += count(s.begin() + n / 10 * i, s.begin() + n / 10 * (i + 1), 'T') == n / 10;
}
cout << res << "\n";
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 | #include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = b; i >= a; i--) #define cat(x) cout << #x << ": " << x << endl using namespace std; using ll = long long; int main() { cin.tie(0)->sync_with_stdio(0); int n; string s; cin >> n >> s; int res = 0; rep(i, 0, 9) { res += count(s.begin() + n / 10 * i, s.begin() + n / 10 * (i + 1), 'T') == n / 10; } cout << res << "\n"; return 0; } |
English