#include <iostream>
using namespace std;
int n, wyn, test,wiel;
string odp;
int main()
{
cin>>n;
cin>>odp;
wiel=n/10;
for (int i =0; i<n; i+=wiel){
test=true;
for ( int j=i; j<i+wiel;j++){
if(odp[j]!='T'){
test=false;
}
}
if (test==true){
wyn++;
}
}
cout<<endl<<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 | #include <iostream> using namespace std; int n, wyn, test,wiel; string odp; int main() { cin>>n; cin>>odp; wiel=n/10; for (int i =0; i<n; i+=wiel){ test=true; for ( int j=i; j<i+wiel;j++){ if(odp[j]!='T'){ test=false; } } if (test==true){ wyn++; } } cout<<endl<<wyn; } |
English