interp alias {} R {} string repl
interp alias {} G {} string ran
interp alias {} S {} set
S a {/\ \ /\ /\ \ / / /\ /\ /\ /\ / \ / / }
S b {\ \ \ / /\\/\\/\\/\ \\/\\/\\/\\/\\ /\\/ \/ }
S c { \/ \/ / / \/ \/ \ \/ \/ \/ \/ \ }
S N [gets stdin]
S L [string len $N]
for {S n 0} {$n < $L*2+1} {incr n} {
S r$n [string repe " " $L]
}
S row 0
for {S n [expr {$L-1}]} {$n != -1} {incr n -1} {
S x0 [expr {$n * 2}]
S x2 [expr {$x0 + 2}]
S d 0x[string ind $N $n]
S c0 [expr {$d * 3}]
S c2 [expr {$c0 + 2}]
S r$row [R [S r$row] $x0 $x2 [G $a $c0 $c2]]
incr row
S r$row [R [S r$row] $x0 $x2 [G $b $c0 $c2]]
incr row
S r$row [R [S r$row] $x0 $x2 [G $c $c0 $c2]]
}
for {S n 0} {$n < $L*2+1} {incr n} {
S end [expr {($L-(($n-1)/2))*2}]
S out [G [set r$n] 0 $end]
if {$n == 0} {S out [string trimr $out]}
puts $out
}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).