sub base8{ my($s) = @_; my $i = 0; my $ret = 0; for(split//,$s){ $ret+=$_; $ret*=2; $i++ } $ret/2; } $_=<>;chomp; s/A/1010/g; s/B/1011/g; s/C/1100/g; s/D/1101/g; s/E/1110/g; s/F/1111/g; while($_){ $a = base8(substr($_,-3)); $h{$a}++; $_=substr($_,0,-3); } $max = 0; for $i(keys %h){ $max=$h{$i}if$max<$h{$i};} for $i(sort keys %h){push @ans, $i if$max==$h{$i};} print join " ",@ans,$/;