#include <bits/stdc++.h>
using namespace std;
int n, wynik = 0;
string napis, grupa = "";
bool czyPoprawny(string test){
for (char pytanie: test){
if (pytanie == 'N'){
return false;
}
}
return true;
}
int main(){
cin>>n;
cin>>napis;
for (int i = 0; i < n; i++){
grupa+=napis[i];
if (grupa.length() == n/10){
wynik += czyPoprawny(grupa);
grupa = "";
}
}
cout<<wynik<<'\n';
}
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 <bits/stdc++.h> using namespace std; int n, wynik = 0; string napis, grupa = ""; bool czyPoprawny(string test){ for (char pytanie: test){ if (pytanie == 'N'){ return false; } } return true; } int main(){ cin>>n; cin>>napis; for (int i = 0; i < n; i++){ grupa+=napis[i]; if (grupa.length() == n/10){ wynik += czyPoprawny(grupa); grupa = ""; } } cout<<wynik<<'\n'; } |
English