Preview:
#include <bits/stdc++.h>

using namespace std;

int main()
{
   string s="a1b2c3d4e5f6g7h8i9j1k2l3m4";
   string w1="";
   string w2="";
   int n=s.size();
   for(int i=0;i<n;i++)
   {
       if(i%2==0) {w1+=s[i];}
       else w2+=s[i];
   }
   cout<<w1+w2<<"\n";
   cout<<w1.append(w2);
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter