install ruby, run irb, paste the following with your own text subsituted:
text = "The quick brown fox jumps over the lazy dog"
words = text.split(' ')
f1 = 0 f2 = 1
words.each_with_index do |word, i| if i == f1 puts word f1 = f2 f2 = i + f1 redo if i == f1 end end
example output:
The quick quick brown fox over dog
install ruby, run irb, paste the following with your own text subsituted:
> text = "The quick brown fox jumps over the lazy dog"
>
> words = text.split(' ')
>
> f1 = 0
> f2 = 1
>
> words.each_with_index do |word, i|
> if i == f1
> puts word
> f1 = f2
> f2 = i + f1
> redo if i == f1
> end
>end
example output:
>The
>quick
>quick
>brown
>fox
>over
>dog
(post is archived)