37 lines
461 B
D
37 lines
461 B
D
import std.algorithm;
|
|
import std.uni;
|
|
import std.array;
|
|
import std.file;
|
|
import std.stdio;
|
|
|
|
void main()
|
|
{
|
|
readText("input").calculateTotalNumberOfQuestions.writeln;
|
|
}
|
|
|
|
auto calculateTotalNumberOfQuestions(string input)
|
|
{
|
|
return input.splitter("\n\n")
|
|
.array.map!(group => group.filter!isAlpha.array.sort.uniq.count).sum;
|
|
}
|
|
|
|
unittest
|
|
{
|
|
auto input = `abc
|
|
|
|
a
|
|
b
|
|
c
|
|
|
|
ab
|
|
ac
|
|
|
|
a
|
|
a
|
|
a
|
|
a
|
|
|
|
b`;
|
|
|
|
assert(input.calculateTotalNumberOfQuestions == 11);
|
|
}
|