Hacker News new | ask | show | jobs
by mmaldacker 4044 days ago
dictionary is not necessary, the C++ impl just counts the number of words. This can be written as:

  int word_count(const char *const filename)
  {
    std::ifstream file{filename};
    return std::distance(std::istream_iterator<std::string>{file}, {}); 
  }