duplicate certain lines _A_ by Wei

main=interact(unlines.g.lines)
g(x:xs)=h(map read(words x))xs 1[]
h t(x:xs)i r=h t xs(i+1)(r++if elem i t then[x,x]else[x])
h _[]_ r=r

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page