#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main() { int n; int set_size; string results; int result = 0; cin >> n >> results; set_size = results.length()/10; for (int i=0; i<results.length(); i+=set_size) { string set_result = results.substr(i, set_size); if (count(set_result.begin(), set_result.end(), 'T') == set_size) { result++; } } cout << result << endl; 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 | #include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main() { int n; int set_size; string results; int result = 0; cin >> n >> results; set_size = results.length()/10; for (int i=0; i<results.length(); i+=set_size) { string set_result = results.substr(i, set_size); if (count(set_result.begin(), set_result.end(), 'T') == set_size) { result++; } } cout << result << endl; return 0; } |