#include <bits/stdc++.h> using namespace std; signed main() { int n; string s; cin >> n >> s; int ans=0; for(int i=0;i<n;i+=n/10) { string t=s.substr(i,n/10); ++ans; for(auto x:t) { if(x!='T') { --ans; break; } } } cout << ans; 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 | #include <bits/stdc++.h> using namespace std; signed main() { int n; string s; cin >> n >> s; int ans=0; for(int i=0;i<n;i+=n/10) { string t=s.substr(i,n/10); ++ans; for(auto x:t) { if(x!='T') { --ans; break; } } } cout << ans; return 0; } |