Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.36 KB | None | 0 0
  1.     auto file = File("file.txt"); // Open for reading
  2.     const wordCount = file.byLine()                  // Read lines
  3.                           .map!split                 // Split into words
  4.                           .map!(a => a.length)       // Count words per line
  5.                           .reduce!((a, b) => a + b); // Total word count
  6.     writeln(wordCount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement