Solve Frequent Words Problem