#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int n, p, t=1, w=0, m;
cin>>n;
cin>>s;
p=n/10;
for(int i=0; i<10; i++){
m=i*p;
t=1;
for(int j=0; j<p; j++){
if(s[m+j]=='N'){
t=0;
break;
}
}
if(t==1) 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 | #include <bits/stdc++.h> using namespace std; int main(){ string s; int n, p, t=1, w=0, m; cin>>n; cin>>s; p=n/10; for(int i=0; i<10; i++){ m=i*p; t=1; for(int j=0; j<p; j++){ if(s[m+j]=='N'){ t=0; break; } } if(t==1) w++; } cout<<w; return 0; } |
English