#include <iostream> using namespace std; int main() { int n, res = 0; cin >> n; string s; cin >> s; int k = n / 10; for (int i = 0; i < n; i += k) { bool wa = false; for (int j = i; !wa && j < i + k; j++) wa = (s[j] == 'N'); res += !wa; } cout << res << '\n'; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int main() { int n, res = 0; cin >> n; string s; cin >> s; int k = n / 10; for (int i = 0; i < n; i += k) { bool wa = false; for (int j = i; !wa && j < i + k; j++) wa = (s[j] == 'N'); res += !wa; } cout << res << '\n'; } |