wave line by node

<?$q=strlen($s=fgets(STDIN));$c=$i=0;for(;$i<$q;$p=$s[$i],$z<$p&&$c--,$z>$p&&$c++,$t[$c][$i]=$z=$p,$i++);ksort($t);
foreach($t as $v){for($i=0,$l='';$i<$q;$l.=isset($v[$i])?$v[$i]:' ',$i++);echo rtrim($l)."\n";}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page