Comment Comment by mmaldacker 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}, {}); } parent mmaldacker 11 years ago