I have one string 'abcdef'
Need to print element like first element, last element, second element, second last element
Expected out is
afbecdAnother output for
abcdeExpected isaebdcCan we do it in without creating a extra list
pseudo code:
str1 = 'abcdef'
i= 0
j = 1
new_str = ''
while (i < len(str1) && j > len(str1) and i!=j):
new_str = str1[i] + str1[j]