compute char frequencies