Skip to main content
2 of 5
deleted 6 characters in body

Ruby, 88 bytes

->s{v=[];while s.length>0;s.reject!(&:empty?);v<<s.map{_1[0]};s.map!{_1[1..]}end;v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;
  • v<<s.map{_1[0]} the first letters are added to the output vector
  • s.map!{_1[1..]} and the first letters are removed
  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string