foreach s [split [read stdin] \n] {regexp {((d )*)(.*)} $s _ d _ x foreach _ $d+ {puts $x}}