11 lines
505 B
Text
11 lines
505 B
Text
nds:=File("daysOfWeek.txt").read().howza(11) // stripped lines
|
|
.pump(List,Void.Filter,fcn(day){
|
|
d,N,m := day.split(),d.len(),(0).max(d.apply("len")); // N==7
|
|
foreach n in ([1..m]){
|
|
ds:=d.apply("get",0,n); // ("Su","Mo","Tu","We","Th","Fr","Sa")
|
|
foreach a,b in (N,[a+1..N-1]){ if(ds[a]==ds[b]) continue(3); } # Th==Fr?
|
|
return(n,day); // part way though the words and found unique
|
|
}
|
|
return(m,day); // no match nowhere
|
|
});
|
|
foreach n,s in (nds){ println("%3d %s".fmt(n,s)); }
|