Promi_38

cf 1216A

Oct 19th, 2021
605
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits\stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     string s;
  10.     cin >> s;
  11.    
  12.     int c = 0, i;
  13.     for(i = 0; i < n; i += 2)
  14.     {
  15.         if(s[i] == s[i+1]) c++;
  16.     }
  17.    
  18.     printf("%d\n", c);
  19.     for(i = 0; i < n; i += 2)
  20.     {
  21.         if(s[i] == s[i+1])
  22.         {
  23.             s[i] = 'a';
  24.             s[i+1] = 'b';
  25.         }
  26.     }
  27.     cout << s << endl;
  28. }
  29.  
RAW Paste Data