#include <iostream> using namespace std; int main() { int n,w=0,x; cin>>n; string s; cin>>s; bool pom; for(int i=0;i<n;){ pom=1; x=n/10; while(x){ if(s[i]=='N')pom=0; i++; x--; } if(pom)w++; } cout<<w; 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 25 | #include <iostream> using namespace std; int main() { int n,w=0,x; cin>>n; string s; cin>>s; bool pom; for(int i=0;i<n;){ pom=1; x=n/10; while(x){ if(s[i]=='N')pom=0; i++; x--; } if(pom)w++; } cout<<w; return 0; } |