#include <cstdio> const int max_n = 10000; int n; char input[max_n]; int main() { scanf(" %d %s ", &n, input); int count = 0; for (int i = 0; i < 10; ++i) { int good = 0; for (int j = 0; j < n / 10; ++j) { good += input[i * (n / 10) + j] == 'T'; } count += good == n / 10; } printf("%d\n", count); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <cstdio> const int max_n = 10000; int n; char input[max_n]; int main() { scanf(" %d %s ", &n, input); int count = 0; for (int i = 0; i < 10; ++i) { int good = 0; for (int j = 0; j < n / 10; ++j) { good += input[i * (n / 10) + j] == 'T'; } count += good == n / 10; } printf("%d\n", count); return 0; } |