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