#include <iostream> using namespace std; int main() { int n,t=1,x=0,wyn=0; char temp; cin>>n; for(int a=0;a<n;a++) { cin>>temp; if(temp=='T')x++; if(t==n/10) { if(x==n/10)wyn++; t=1; x=0; } else t++; } cout<<wyn; }
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 | #include <iostream> using namespace std; int main() { int n,t=1,x=0,wyn=0; char temp; cin>>n; for(int a=0;a<n;a++) { cin>>temp; if(temp=='T')x++; if(t==n/10) { if(x==n/10)wyn++; t=1; x=0; } else t++; } cout<<wyn; } |