SHARE
TWEET

A

a guest Sep 21st, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int g,t,re;
  6.     string q;
  7.     scanf("%d",&t);
  8.     cin>>q;
  9.     for(g=2,re=0;g<=t;g+=2)
  10.         if(q[g-1]=='a'&&q[g-2]=='a')re++, q[g-1]='b';
  11.         else if(q[g-1]=='b'&&q[g-2]=='b')re++, q[g-2]='a';
  12.     printf("%d\n",re);
  13.     cout<<q<<endl;
  14.     return 0;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top