#include <iostream> using namespace std; int main() { int n, w = 0; bool g = 1; string s; cin>>n>>s; for (int i = 0; i < n; i ++) { g = min(g, s[i] == 'T'); if ((i + 1) % (n / 10) == 0) { w += g; g = 1; } } cout<<w<<'\n'; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { int n, w = 0; bool g = 1; string s; cin>>n>>s; for (int i = 0; i < n; i ++) { g = min(g, s[i] == 'T'); if ((i + 1) % (n / 10) == 0) { w += g; g = 1; } } cout<<w<<'\n'; } |