#include <bits/stdc++.h> typedef long long ll; using namespace std; const ll inf = 1e9 + 7; ll n , m , k , ans = 0 , q; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; string s; cin >> s; ll kol = n / 10; for (int i = 0; i < 10; i++) { bool f = 0; for (int j = i * kol; j < (i + 1) * kol; j++) { if (s[j] != 'T') { f = 1; break; } } if (!f)ans++; } cout << ans; } /* 20 TTNNTTNTNTNNNNNNNNTT */
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> typedef long long ll; using namespace std; const ll inf = 1e9 + 7; ll n , m , k , ans = 0 , q; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; string s; cin >> s; ll kol = n / 10; for (int i = 0; i < 10; i++) { bool f = 0; for (int j = i * kol; j < (i + 1) * kol; j++) { if (s[j] != 'T') { f = 1; break; } } if (!f)ans++; } cout << ans; } /* 20 TTNNTTNTNTNNNNNNNNTT */ |