#!/usr/bin/env perl
# Perl version, the fastest (because of course it is)
sub hashcode {
    my ($str) = @_;
    $str .= 'X';
    my $hash = 0;
    for (0..(length($str) - 1)) {
        $hash = ($hash * 173 + ord(substr($str, $_, 1))) & 0xFF;
    }
    $hash
}

$/ = '';
my $str = <>;
chomp $str;
printf "\033[38;5;%sm%s\n", hashcode($str), $str;