5 ms·
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::if
by mmaldacker 11y 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}, {});
}