#include <iostream> #include <string> using namespace std; int main () { int n; cin >> n; string s; cin >> s; int k= n / 10; int wnk= 10; for (int i=0; i<n; i+=k) for (int j=0; j<k; j++) if (s[i+j] == 'N') { wnk--; break; } cout << wnk << endl; 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 | #include <iostream> #include <string> using namespace std; int main () { int n; cin >> n; string s; cin >> s; int k= n / 10; int wnk= 10; for (int i=0; i<n; i+=k) for (int j=0; j<k; j++) if (s[i+j] == 'N') { wnk--; break; } cout << wnk << endl; return 0; } |