# JavaScript (ES7), 83 bytes s=>s.repeat(l=s.length).replace(/./g,(_,i)=>s[(l*l+~i)**.5&1^l&1?++c%l:--c%l],c=-1) This is not much shorter than an ES3-compliant program: for(s=prompt(r=""),c=-1,l=i=s.length;i--;)for(j=i*2+1;j--;)r+=s[(c+=(l-i)%2*2-1)%l];alert(r)