#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main (){
int n, wyn=0, w=0;
string s;
cin>>n>>s;
for (int i=1; i<=n; i++){
if(s[i-1]=='T') w++;
if(i%(n/10)==0){
if(w==n/10) wyn++;
w=0;
}
}
cout<<wyn;
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 | #include <bits/stdc++.h> using namespace std; typedef long long LL; int main (){ int n, wyn=0, w=0; string s; cin>>n>>s; for (int i=1; i<=n; i++){ if(s[i-1]=='T') w++; if(i%(n/10)==0){ if(w==n/10) wyn++; w=0; } } cout<<wyn; return 0; } |
English