Last letter-first letter: Difference between revisions

Content deleted Content added
Added zkl
Updated D version 4
Line 1,255: Line 1,255:
std.container, std.range;
std.container, std.range;


auto findChain(in string[] seq) /*pure nothrow*/ {
auto findChain(in string[] seq) /*pure*/ nothrow {
const adj = seq
const adj = seq
.map!(item => tuple(item,
.map!(item => tuple(item, seq
seq
.filter!(x => x[0] == item[$ - 1])
.filter!(x => x[0] == item[$-1])
.array))
.array))
.assocArray;
.assocArray;
SList!string res;
SList!string res;


foreach (immutable item; adj.byKey) { // Not nothrow.
foreach (immutable item; adj.byKey) {
void inner(in string it, SList!string lst) nothrow {
void inner(in string it, SList!string lst) nothrow {
lst.insertFront(it);
lst.insertFront(it);