#include <iostream>
#include <string>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(NULL);
int n; std::cin >> n;
int help = n / 10;
std::string s;
std::cin >> s;
int res = 0;
for (int i = 0; i < s.size(); i += help) {
bool ok = true;
for (int j = i; j < i + help; j++)
ok &= (s[j] == 'T');
if (ok)
res ++;
}
std::cout << res << '\n';
}
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 | #include <iostream> #include <string> int main() { std::ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int n; std::cin >> n; int help = n / 10; std::string s; std::cin >> s; int res = 0; for (int i = 0; i < s.size(); i += help) { bool ok = true; for (int j = i; j < i + help; j++) ok &= (s[j] == 'T'); if (ok) res ++; } std::cout << res << '\n'; } |
English