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