#include <bits/stdc++.h> using namespace std; int n, t, p, w; string s; int main (){ cin >> n; cin >> s; t=n/10; for (int i=0;i<10;i++) { p=1; for (int j=0;j<t;j++){ if (s[t*i+j]=='N') p=0; } if (p!=0) w++; } cout << w; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <bits/stdc++.h> using namespace std; int n, t, p, w; string s; int main (){ cin >> n; cin >> s; t=n/10; for (int i=0;i<10;i++) { p=1; for (int j=0;j<t;j++){ if (s[t*i+j]=='N') p=0; } if (p!=0) w++; } cout << w; } |