# Befunge-98, 68 bytes

 &:!#@_000pv<
 :kg00 ',|'<|`g00:p00+1g00,a,\'$,kg00
 00:k+1g00-'<@,k+1g