Change e letters to i in words
var file = File("unixdict.txt")
if (!file.exists) {
require('LWP::Simple')
say ":: Retrieving #{file} from internet..."
%S<LWP::Simple>.mirror(
'https://web.archive.org/web/20180611003215if_/' +
'http://www.puzzlers.org:80/pub/wordlists/unixdict.txt',
'unixdict.txt')
}
var words = file.read.words
var dict = Hash().set_keys(words...)
var count = 0
words.each {|word|
word.len > 5 || next
word.contains('e') || next
var changed = word.gsub('e', 'i')
if (dict.contains(changed)) {
printf("%2d: %20s <-> %s\n", ++count, word, changed)
}
}Output:
Last updated
Was this helpful?