#include <iostream>
#include <cstring>
using namespace std;
int main() {
int x;
cin >> x;
string tnt;
cin >> tnt;
char a[x];
strcpy(a, tnt.c_str());
int kawalek = x / 10;
int licz = 0;
int score = 0;
for (int i = 0; i < x; ++i) {
if(i%kawalek==0){
licz=0;
}
if (a[i] == 'T') {
licz++;
}
else {
licz = -1;
}
if (licz == kawalek) {
score++;
licz=0;
}
}
cout<<score;
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 25 26 27 28 29 30 31 32 33 | #include <iostream> #include <cstring> using namespace std; int main() { int x; cin >> x; string tnt; cin >> tnt; char a[x]; strcpy(a, tnt.c_str()); int kawalek = x / 10; int licz = 0; int score = 0; for (int i = 0; i < x; ++i) { if(i%kawalek==0){ licz=0; } if (a[i] == 'T') { licz++; } else { licz = -1; } if (licz == kawalek) { score++; licz=0; } } cout<<score; return 0; } |
English