Find words whose first and last three letters are equal
Use the dictionary unixdict.txt Find the words which first and last three letters are equals.
Find words whose first and last three letters are equal is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
The length of any word shown should have a length > 5.
Ring
<lang ring> load "stdlib.ring"
cStr = read("unixdict.txt") wordList = str2list(cStr) num = 0
see "working..." + nl see "Words are:" + nl
ln = len(wordList) for n = ln to 1 step -1
if len(wordList[n]) < 6 del(wordList,n) ok
next
for n = 1 to len(wordList)
if left(wordList[n],3) = right(wordList[n],3) num = num + 1 see "" + num + ". " + wordList[n] + nl ok
next
see "done..." + nl </lang> Output:
working... Words are: 1. antiperspirant 2. calendrical 3. einstein 4. hotshot 5. murmur 6. oshkosh 7. tartar 8. testes done...