Rosetta Code/Find bare lang tags: Difference between revisions

no edit summary
No edit summary
Line 236:
1 in Perl ([[Huffman_coding]])
1 in PostScript ([[100_doors]])
</pre>
 
==Icon and {{header|Unicon}}==
 
The following is a Unicon-specific solution.
<lang unicon>import Utils # To get the FindFirst class
 
procedure main()
keys := ["{{header|","<lang>"]
lang := "No language"
tags := table(0)
total := 0
 
ff := FindFirst(keys)
f := reads(&input, -1)
 
f ? while tab(ff.locate()) do {
if "{{header|" == 1(ff.getMatch(), ff.moveMatch()) then lang := map(tab(upto("}}")))
else (tags[lang] +:= 1, total +:= 1)
}
 
write(total," bare language tags:\n")
every pair := !sort(tags) do write(pair[2]," in ",pair[1])
end</lang>
 
Sample run using example given in problem statement:
<pre>
->rcfblt <rcfblt.in
2 bare language tags:
 
1 in No language
1 in perl
->
</pre>