Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- string niza;
- cin>>niza;
- int counter=0;
- for(int i=0; i<niza.size(); i++){
- if(niza[i]=='Y'){
- for(int j=i; j<niza.size(); j += i + 1){
- if(niza[j]=='Y'){
- niza[j]='N';
- }
- else if(niza[j]=='N'){
- niza[j]='Y';
- }
- }
- counter++;
- }
- }
- cout<<counter;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement