#!/usr/bin/perl

#
#                               to phil reither
#                     (c) by nostromo, Sun Nov 24 CET 2003
#                         as a happy-birthday present.
#

use POSIX qw (ceil floor);

@in = ("'##::: ##: '########:: ##.... ##: ##:::: ##: ########:: ##.." .
       "...::: ##:::::::: ##::::::::..:::::::::"," ###:: ##: '##::::" .
       "'##: ##:::: ##: ##:::: ##: #########: ##.... ##: ##:::: ##: " .
       "##:::: ##:..:::::..::"," ####:'####:. ##::: ##::: ##::: ##::" .
       ": ##::'####:....::"," ##: ## ##'##::::::: ##::::::: ##::::::" .
       ": ##::::::: ##::::::: ##::::::: ##::::::: ########:........:" .
       ":"," ##: ##. #''########:: ##.... ##: ##:::: ##: ########:: " .
       "##.. ##::: ##::. ##:: ##:::. ##:..:::::..::",":###: ##:. :'#" .
       "######::'##.... ##: ##:::: ##: ##:::: ##: ##:::: ##: ##:::: " .
       "##:. #######:::.......:::","###: ##::.''##::::'##:. ##::'##:" .
       "::. ##'##:::::. ###:::::: ## ##:::: ##:. ##:: ##:::. ##:..::" .
       ":::..::"," ##: ..::::::'#####::::'##.. ##::'##:::: ##: ##:::" .
       ": ##: ##:::: ##:. ##:: ##:::. #####:::::.....::::","11011106" .
       "2103114115116116117114");

open(IN, "stty -a |");
while(<IN>)
{
    ($tw = $1) if s/columns\ (\d+)//;
}

@out = (split/(\d{3})/, $in[$#in]); close IN;

foreach $eoa (@out)
{
    next unless $eoa =~ s/(\d{2})(\d)/$2/;
    $am = int($1); $item = (@in[$eoa]);
    while($item =~ s/.{$am}(.{$am})(.*)/$1$2/)
    {
        print ":"x(ceil(($tw-$am)/2)) . "$1" .
              ":"x(floor(($tw-$am)/2)) . "\n";
    }
    sleep 1;
}