word frequency methods compile and run but are wrong