Jump to content

Last letter-first letter: Difference between revisions

m
→‎brute force version: added/changed whitespace and comments.
(Added Wren)
m (→‎brute force version: added/changed whitespace and comments.)
Line 3,970:
'remoraid rufflet sableye scolipede scrafty seaking sealeo silcoon simisear snivy snorlax spoink',
'starly tirtouga trapinch treecko tyrogue vigoroth vulpix wailord wartortle whismur wingull yamask'
#= words(@); @.=; ig= 0; !.= 0; @.= /*nullify array and the longest path. */
parse arg limit .; if limit\=='' then #=limit /*allow user to specify a scan limit. */
call build@ /*build a stemmed array from the @ list*/
Line 3,976:
parse var @.v F 2 '' -1 L /*obtain first and last letter of word.*/
if !.1.F>1 | !.9.L>1 then iterate /*is this a dead word?*/
say 'ignoring dead word:' @.v; ig= ig + 1; @= delword(@, v, 1)
end /*v*/ /*delete dead word from @ ──┘ */
$$$= /*nullify the possible longest path. */
Line 3,988:
g= words($$$)
say 'Of' # "words," MP 'path's(MP) "have the maximum path length of" g'.'
say; say 'One example path of that length is: ' word($$$, 1)
do m=2 to g; say left('', 36) word($$$, m); end /*m*/
exit end /*stick a fork in it, we're all done. */
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
s: if arg(1)==1 then return arg(3); return word( arg(2) 's', 1) /*a pluralizer.*/
Cookies help us deliver our services. By using our services, you agree to our use of cookies.