#include<bits/stdc++.h>
using namespace std;
int n, s, w, d;
char c;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
s = 0;
w = 0;
d = n/10;
for (int i=1; i<=n; i++) {
cin >> c;
if (c == 'T') {
s++;
}
if (i%d==0) {
if (s==d) {
w++;
}
s=0;
}
}
cout << w;
}
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 27 28 | #include<bits/stdc++.h> using namespace std; int n, s, w, d; char c; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; s = 0; w = 0; d = n/10; for (int i=1; i<=n; i++) { cin >> c; if (c == 'T') { s++; } if (i%d==0) { if (s==d) { w++; } s=0; } } cout << w; } |
English