Find words whose first and last three letters are equal: Difference between revisions
Find words whose first and last three letters are equal (view source)
Revision as of 00:00, 16 January 2023
, 1 year agoAdded AppleScript.
(→{{header|Ruby}}: removed chomped temp array) |
(Added AppleScript.) |
||
Line 143:
found 8 words with the same first and last 3 characters
</pre>
=={{header|AppleScript}}==
<syntaxhighlight lang="applescript">on task()
script o
property wrds : words of ¬
(read file ((path to desktop as text) & "www.rosettacode.org:unixdict.txt") as «class utf8»)
property output : {}
end script
repeat with thisWord in o's wrds
if ((thisWord's length > 5) and (thisWord ends with thisWord's text 1 thru 3)) then ¬
set end of o's output to thisWord
end repeat
return o's output's contents
end task
task()</syntaxhighlight>
{{output}}
<syntaxhighlight lang="applescript">{"antiperspirant", "calendrical", "einstein", "hotshot", "murmur", "oshkosh", "tartar", "testes"}</syntaxhighlight>
=={{header|Arturo}}==
|