Author: Ismail Hosen
Daffodil International University
Problem Link
//Please Follow From Main Function
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
string s1="";
cin>>s;
int len=s.size();
int left=len-1;
bool l=true;
int right=0;
if(len%2==0)
{
bool l=true;
}
else l=false;
while(true)
{
if(l)
{
s1+=s[left];
l=false;
left--;
}
else
{
s1+=s[right];
right++;
l=true;
}
if((left<(len/2)-1) || right>(len/2)+1)break;
}
string s2="";
for(int i=len-1; i>=0; i--)
{
s2+=s1[i];
}
cout<<s2<<endl;
return 0;
}
0 Comments