Evaluated set brr {y r r e b}; set cur 0; set fag [regsub -all {(f|a|g)} [berry] [invert " "]]; set out ""; for {set i 0} {$i < [string length $fag]} {incr i} { if {[string index $fag $i] eq ":"} {append out [lindex $brr $cur]} else {append out [string index $fag $i]};if {$cur > 3} {set cur 0} {incr cur}};. $out