#!/usr/bin/env ruby

stat = {}
File.open(ARGV[0], "r") do |infile|
  while (line = infile.gets)
    next if line =~ /Bird Computer/

#    puts line.split.join(' ')
    line.split.each do |literal|
      if literal =~ /^[A-Z.]{2,}/
#        puts "--- literal: #{literal}"
        stat[literal] = stat.has_key?(literal) ? stat[literal]+1 : 1
        break
      end
    end
  end
end

puts "=================== Asm68k Statistic ==========================="
stat.sort{|a,b| b[1] <=> a[1]}.each do |k, v|
  puts "#{k}: #{v}"
end
