Comment detail

LL Golf Hole 4 - 文章から単語の索引を作る (Nested Flatten)

JavaScript(Rhino)で。入力は標準入力から。 225byte。

1
2
3
4
r=new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.System["in"]));
d={};
for(i=1;l=r.readLine();i++)for(a=l.match(/\w+/g);w=a&&a.pop();)(d[w]=d[w]||[]).push(i);
for(w in d)println(w+":"+d[w].join(" "));

Index

Feed

Other

Link

Pathtraq

loading...