#PHP, 187 bytes
PHP, 187 bytes
preg_match_all('/(\d+)(\w)/',$argv[1],$m,2);
$o='';
foreach($m as $p)
$o.=str_replace('--','- ',str_repeat($p[2]<'P'?'=':'-',$p[1]));
$a=preg_replace('/./','_',$o);
echo("$a\n\n\n$o\n\n$a\n");
The code can stay on a single line; it is displayed here on multiple lines to be more readable (the whitespaces and newlines used for formatting were not counted).
Two bytes can be saved by not printing the trailing newline. Five more bytes can be saved by using real newline characters on the echo():
echo("$a
$o
$a");
Six additional bytes can be saved by omitting the initialization of $o ($o='';) but this will trigger a notice. The notice can be suppressed by running the script using the command line:
$ php -d error_reporting=0 <script_name> 4N4P9N7P1N1P2N2P
These brings it to 174 bytes.
#PHP, 187 bytes
preg_match_all('/(\d+)(\w)/',$argv[1],$m,2);
$o='';
foreach($m as $p)
$o.=str_replace('--','- ',str_repeat($p[2]<'P'?'=':'-',$p[1]));
$a=preg_replace('/./','_',$o);
echo("$a\n\n\n$o\n\n$a\n");
The code can stay on a single line; it is displayed here on multiple lines to be more readable (the whitespaces and newlines used for formatting were not counted).
Two bytes can be saved by not printing the trailing newline. Five more bytes can be saved by using real newline characters on the echo():
echo("$a
$o
$a");
Six additional bytes can be saved by omitting the initialization of $o ($o='';) but this will trigger a notice. The notice can be suppressed by running the script using the command line:
$ php -d error_reporting=0 <script_name> 4N4P9N7P1N1P2N2P
These brings it to 174 bytes.
PHP, 187 bytes
preg_match_all('/(\d+)(\w)/',$argv[1],$m,2);
$o='';
foreach($m as $p)
$o.=str_replace('--','- ',str_repeat($p[2]<'P'?'=':'-',$p[1]));
$a=preg_replace('/./','_',$o);
echo("$a\n\n\n$o\n\n$a\n");
The code can stay on a single line; it is displayed here on multiple lines to be more readable (the whitespaces and newlines used for formatting were not counted).
Two bytes can be saved by not printing the trailing newline. Five more bytes can be saved by using real newline characters on the echo():
echo("$a
$o
$a");
Six additional bytes can be saved by omitting the initialization of $o ($o='';) but this will trigger a notice. The notice can be suppressed by running the script using the command line:
$ php -d error_reporting=0 <script_name> 4N4P9N7P1N1P2N2P
These brings it to 174 bytes.
#PHP, 187 bytes
preg_match_all('/(\d+)(\w)/',$argv[1],$m,2);
$o='';
foreach($m as $p)
$o.=str_replace('--','- ',str_repeat($p[2]<'P'?'=':'-',$p[1]));
$a=preg_replace('/./','_',$o);
echo("$a\n\n\n$o\n\n$a\n");
The code can stay on a single line; it is displayed here on multiple lines to be more readable (the whitespaces and newlines used for formatting were not counted).
Two bytes can be saved by not printing the trailing newline. Five more bytes can be saved by using real newline characters on the echo():
echo("$a
$o
$a");
Six additional bytes can be saved by omitting the initialization of $o ($o='';) but this will trigger a notice. The notice can be suppressed by running the script using the command line:
$ php -d error_reporting=0 <script_name> 4N4P9N7P1N1P2N2P
These brings it to 174 bytes.