#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; string s; cin>>s; assert(n%10 == 0); int ans=0, x=n/10; for (int k=0; k<10; ++k) { bool ok=true; for (int i=x*k; i<(k+1)*x; ++i) ok &= s[i] == 'T'; ans+=ok; } cout<<ans<<"\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; string s; cin>>s; assert(n%10 == 0); int ans=0, x=n/10; for (int k=0; k<10; ++k) { bool ok=true; for (int i=x*k; i<(k+1)*x; ++i) ok &= s[i] == 'T'; ans+=ok; } cout<<ans<<"\n"; } |