Josif_tepe

Untitled

Feb 7th, 2026
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8.     string s;
  9.     cin >> s;
  10.    
  11.    
  12.     int res = 0;
  13.     for(int i = 0; i < s.length(); i++) {
  14.         if(s[i] == 'Y') {
  15.             for(int j = i; j < s.length(); j += i + 1) {
  16.                 if(s[j] == 'N') {
  17.                     s[j] = 'Y';
  18.                 }
  19.                 else {
  20.                     s[j] = 'N';
  21.                 }
  22.             }
  23.             res++;
  24.         }
  25.     }
  26.    
  27.     cout << res << endl;
  28.     return 0;
  29. }
  30.  
  31. /// YNYYYNYNY
  32.  
Advertisement
Add Comment
Please, Sign In to add comment