Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto file = File("file.txt"); // Open for reading
- const wordCount = file.byLine() // Read lines
- .map!split // Split into words
- .map!(a => a.length) // Count words per line
- .reduce!((a, b) => a + b); // Total word count
- writeln(wordCount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement