Odd words: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (Added Arturo implementation) |
|||
Line 672: | Line 672: | ||
terminable : trial |
terminable : trial |
||
</pre> |
</pre> |
||
=={{header|Nim}}== |
|||
<lang Nim>import sets, strformat, sugar |
|||
const DictFile = "unixdict.txt" |
|||
let words = collect(initHashSet, for word in DictFile.lines: {word}) |
|||
var count = 0 |
|||
for word in DictFile.lines: |
|||
var oddWord: string |
|||
for i in countup(0, word.high, 2): oddWord.add word[i] # First odd char is at index 0. |
|||
if oddWord.len > 4 and oddWord in words: |
|||
inc count |
|||
echo &"{count:2}: {word:12} → {oddWord}"</lang> |
|||
{{out}} |
|||
<pre> 1: barbarian → brain |
|||
2: childbear → cider |
|||
3: corrigenda → cried |
|||
4: gargantuan → grata |
|||
5: headdress → hades |
|||
6: palladian → plain |
|||
7: propionate → point |
|||
8: salvation → slain |
|||
9: siltation → slain |
|||
10: slingshot → sight |
|||
11: statuette → saute |
|||
12: supersede → spree |
|||
13: supervene → spree |
|||
14: terminable → trial</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |