Skip to main content
10 of 16
deleted 59 characters in body
primo
  • 33.7k
  • 5
  • 63
  • 142

Perl - 121 Bytes

#!perl -n print$i>$.+1?$/.($i=1&$.--)x0:l^(L,$i++%2?'0':C)[$i>$.-2-$.%2*2&&vec$_,3*$.+$.%2+$i-5,1] while$.+=2*y/0-9/wPkz\\>?p\177~/ 

Counting the shebang as 1, the newline is left for horizontal sanity. Input is taken from stdin.


Sample Usage

$ echo 0123 | perl seven-slash.pl /\ /\ /\ / / \ \/ \ /\ \ \ \/ $ echo 456789 | perl seven-slash.pl /\ \/\ /\ / \/\ /\ \/ \ / \/\ / \/ \/\ \ / \/\ 

Explanation

Output is generated one byte at a time. Each character is transliterated, and this is then interpretted as a bit array using vec. The bits are stored in the following way:

 /\ 56 \/\ 234 /\ \/ -> 56 01 \/\ 234 \/ 01 

Output alternates between 3 and 5 slashes, so that bits 56 spill over into 01 of the next digit. Bit 7 is not used.


Ruby - 147 Bytes

i=t=0 n=gets.scan(/./){t=t<<9|"×\5ËO\35^Þ\7ß_"[$&.to_i].ord*8}.size*2 putc i-n>2?9-1/~t>>=4+i=1&n-=1:' \/'[(t&31>>n%2)[3+n-i+=1]<<i%2]while t>0 

Input is taken from stdin. Requires Ruby v2.0+, saved with UTF-8 encoding (v1.8 will also work, saved as ANSI).

primo
  • 33.7k
  • 5
  • 63
  • 142