#include<bits/stdc++.h> using namespace std; int sum=0, j; int main() { int a; cin>>a; string b; cin>>b; for(int i=0; i<a; i+=a/10) { j=i; while(b[j]=='T'&&j<i+(a/10)) { ++j; } if(j==i+(a/10)) { ++sum; } } cout<<sum; 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 | #include<bits/stdc++.h> using namespace std; int sum=0, j; int main() { int a; cin>>a; string b; cin>>b; for(int i=0; i<a; i+=a/10) { j=i; while(b[j]=='T'&&j<i+(a/10)) { ++j; } if(j==i+(a/10)) { ++sum; } } cout<<sum; return 0; } |