use strict; 

my @bnames = ('IE', 'Mozilla', 'Safari', 'Opera', 'Lynx');
my %browsers;
my $count = 0;
my %puzzle;
my $field = "\\S+\\s";
while (<STDIN>)
{
    # lose RSS
    next if (m@\"GET /ongoing/ongoing.rss@);

    # lose a few spambots
    next if (/poker|block.alestra.net.mx|hold-?em| 404 |-stud-/i);

    # Lose the first 11 fields
    s/^$field$field$field$field$field$field$field$field$field$field$field//o;

    # lose quotes
    my $b;
    if (/^.*"([^\"]*)"$/)
    {
	$b = $1;
    }

    if    ($b =~ /lynx/i) { $b = 'Lynx'; }
    elsif ($b =~ /Safari/i) { $b = 'Safari'; }
    elsif ($b =~ /opera/i) { $b = 'Opera'; }
    elsif ($b =~ /MSIE/) { $b = 'IE'; }
    elsif ($b =~ /Mozilla.*Gecko/) { $b = 'Mozilla'; }
    else  
    { 
       $puzzle{$b}++;
       next;
    }

    $browsers{$b}++;
    $count++;
}


my $b;

# Turn on from time to time to sanity-check
if (0)
{
    foreach $b (sort keys(%puzzle))
    {
        print "$puzzle{$b} $b\n";
    }
}

$ARGV[0] =~ s/\..*$//;
print "$ARGV[0]\t";
foreach $b (@bnames)
{
    printf "%0.1f\t", 100.0 * $browsers{$b} / $count;
}
print "\n";
