#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string tests;
cin >> tests;
tests += '.';
int pack_size = n / 10, i = 0, j = 0, res = 0;
bool ok = true;
while(tests[i] != '.') {
if(tests[i] == 'N') ok = false;
i++;
j++;
if(j == pack_size) {
if(ok) res++;
j = 0;
ok = true;
}
}
cout << res;
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; int main() { int n; cin >> n; string tests; cin >> tests; tests += '.'; int pack_size = n / 10, i = 0, j = 0, res = 0; bool ok = true; while(tests[i] != '.') { if(tests[i] == 'N') ok = false; i++; j++; if(j == pack_size) { if(ok) res++; j = 0; ok = true; } } cout << res; return 0; } |
English