From: James Gray Date: 2008-03-26T06:16:59+09:00 Subject: Re: golf: tabs to bullets On Mar 25, 2008, at 4:02 PM, Martin DeMello wrote: > Given: > an outline list, with each line indented by a series of tabs > a list of bullets (assume a circular list, for simplicity) > > Write a function that replaces every tab with two spaces, except for > the last one, which is replaced by a bullet. > > example: > > input file: > foo > \t bar > \t \t baz > \t \t \t hello > \t \t world > > bullets: %w(* - o x) > > output (view in fixed width): > foo > * bar > - baz > o hello > - world I didn't really golf it, but my answer is: #!/usr/bin/env ruby -wKU input = <