#!/usr/athena/bin/perl

open(BOYS, "/afs/athena/user/m/k/mkgray/.*/lists/boys");
open(GIRLS, "/afs/athena/user/m/k/mkgray/.*/lists/girls");

while(<BOYS>)
{
	($name, $gen, $responses, $phone) = split(/:/, $_);
	@choices = split(/[0-9]/, $responses);
	@weights = split(/[a-z]/, $responses);
	foreach $x (0..30) {
	$boywtot{$x.$choices[$x]}++;

	}	
	$nb++;
}

while(<GIRLS>)
{
	($name, $gen, $responses, $phone) = split(/:/, $_);
	@choices = split(/[0-9]/, $responses);
	@weights = split(/[a-z]/, $responses);
	foreach $x (0..30) {
	$girlwtot{$x.$choices[$x]}++;

}
$ng++;
}
$t = $ng +$nb;
    open(QS, "/afs/athena/user/m/k/mkgray/.*/lists/questions");
    $cqnu = 0;
    while(<QS>)
    {
        ($question, @options) = split(/:/);
	$q[$i]=$question;
	$a = 'a';
	foreach $opt (@options){
		if($opt=~/\n/){chop($opt);}
		$op{$i.$a}=$opt;
		$a++;
	}
	$i++;
    }

foreach $n (0..25) {
$foo= $n+1;
print("---Question: $q[$n]\n");
	foreach $a ('a'..'f'){
		$tot=$boywtot{$n.$a}+ $girlwtot{$n.$a};
		$perc = int(100*$tot/$t);
#		print("Q$n:$a:\t$boywtot{$n.$a}\t$girlwtot{$n.$a}\t$perc\n");
	print("$op{$n.$a}: $perc%\n");
}
#print("------------\n");

}






