mirror of https://github.com/buggins/dlangide.git
21 lines
357 B
D
21 lines
357 B
D
void main() {
|
|
|
|
|
|
}
|
|
|
|
// Computes average line length for standard input.
|
|
import std.stdio;
|
|
//changed
|
|
void main()
|
|
{
|
|
ulong lines = 0;
|
|
double sumLength = 0;
|
|
foreach (line; stdin.byLine())
|
|
{
|
|
++lines;
|
|
sumLength += line.length;
|
|
}
|
|
writeln("Average line length: ",
|
|
lines ? sumLength / lines : 0);
|
|
}
|