import std.stdio;
import std.ascii;
import std.algorithm;
import std.array;
import std.string;
void main()
{
string[] lines = [
"key1: valueA", "key2: valueB", "key3: valueC", "\tvalueD", " valueE",
"key4: valueF",
];
string currKey;
string currValue;
string[string] keyValueAA;
foreach (line; lines)
{
if (line.canFind(":"))
{
if (currKey != "" && currValue != "")
{
keyValueAA[currKey] = currValue;
}
auto keyValue = line.split(":");
currKey = keyValue[0].strip();
currValue = keyValue[1].strip();
}
else if (line.startsWith!isWhite)
{
currValue = currValue ~ " " ~ line.strip();
}
}
if (currKey != "" && currValue != "")
{
keyValueAA[currKey] = currValue;
}
writeln(keyValueAA);
}
aW1wb3J0IHN0ZC5zdGRpbzsKaW1wb3J0IHN0ZC5hc2NpaTsKaW1wb3J0IHN0ZC5hbGdvcml0aG07CmltcG9ydCBzdGQuYXJyYXk7CmltcG9ydCBzdGQuc3RyaW5nOwoKdm9pZCBtYWluKCkKewogICAgc3RyaW5nW10gbGluZXMgPSBbCiAgICAgICAgImtleTE6IHZhbHVlQSIsICJrZXkyOiB2YWx1ZUIiLCAia2V5MzogdmFsdWVDIiwgIlx0dmFsdWVEIiwgIiAgIHZhbHVlRSIsCiAgICAgICAgImtleTQ6IHZhbHVlRiIsCiAgICBdOwoKICAgIHN0cmluZyBjdXJyS2V5OwogICAgc3RyaW5nIGN1cnJWYWx1ZTsKCiAgICBzdHJpbmdbc3RyaW5nXSBrZXlWYWx1ZUFBOwoKICAgIGZvcmVhY2ggKGxpbmU7IGxpbmVzKQogICAgewogICAgICAgIGlmIChsaW5lLmNhbkZpbmQoIjoiKSkKICAgICAgICB7CiAgICAgICAgICAgIGlmIChjdXJyS2V5ICE9ICIiICYmIGN1cnJWYWx1ZSAhPSAiIikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAga2V5VmFsdWVBQVtjdXJyS2V5XSA9IGN1cnJWYWx1ZTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgYXV0byBrZXlWYWx1ZSA9IGxpbmUuc3BsaXQoIjoi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