2024-01-31 22:30:17 +05:30
|
|
|
import std.algorithm.iteration : filter;
|
|
|
|
import std.algorithm.searching : count;
|
|
|
|
import std.ascii : isAlpha, isWhite;
|
|
|
|
import std.file : read;
|
|
|
|
import std.stdio : writefln;
|
|
|
|
|
2024-03-15 00:39:50 +05:30
|
|
|
void main(string[] argv)
|
2024-01-31 22:30:17 +05:30
|
|
|
{
|
2024-03-15 00:39:50 +05:30
|
|
|
auto fileContent = cast(string)read(argv[1]);
|
2024-01-31 22:30:17 +05:30
|
|
|
auto totalLetters =
|
|
|
|
count(filter!(a => isAlpha(a) || isWhite(a))(fileContent));
|
|
|
|
auto percentage = (totalLetters * 100) / cast(double)fileContent.length;
|
|
|
|
|
2024-03-15 00:40:17 +05:30
|
|
|
writefln("Letters: %.0f%%", percentage);
|
2024-01-31 22:30:17 +05:30
|
|
|
}
|