#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int x = n / 10; string wzo = ""; for(int i = 0; i < x; i++) wzo += 'T'; int points = 0; for(int i = 0; i < n; i += x) if(s.substr(i, x) == wzo) ++points; cout << points; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int x = n / 10; string wzo = ""; for(int i = 0; i < x; i++) wzo += 'T'; int points = 0; for(int i = 0; i < n; i += x) if(s.substr(i, x) == wzo) ++points; cout << points; return 0; } |