#include <bits/stdc++.h> using namespace std; int main (){ int n,i,k,wynik=0,j,p=0; cin>>n; k = n/10; string slowo; cin>>slowo; for (i=0;i<10;++i){ for (j=0;j<k;++j){ if (slowo[i*k+j]=='T') ++p; //cout<<slowo[i*10+j]<<" "; } if (p==k) ++wynik; p = 0; } cout<<wynik; 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 | #include <bits/stdc++.h> using namespace std; int main (){ int n,i,k,wynik=0,j,p=0; cin>>n; k = n/10; string slowo; cin>>slowo; for (i=0;i<10;++i){ for (j=0;j<k;++j){ if (slowo[i*k+j]=='T') ++p; //cout<<slowo[i*10+j]<<" "; } if (p==k) ++wynik; p = 0; } cout<<wynik; return 0; } |