Ordered words: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: optimized the REXX program, changed comments and whitespace, used a template for the output section.) |
No edit summary |
||
Line 3,364: | Line 3,364: | ||
)) |
)) |
||
)</lang> |
)</lang> |
||
{{Out}} |
|||
<pre>abbott |
|||
accent |
|||
accept |
|||
access |
|||
accost |
|||
almost |
|||
bellow |
|||
billow |
|||
biopsy |
|||
chilly |
|||
choosy |
|||
choppy |
|||
effort |
|||
floppy |
|||
glossy |
|||
knotty</pre> |
|||
=={{header|R}}== |
|||
<lang R>words = scan("https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt",what = "character") |
|||
ordered = logical() |
|||
for(i in 1:length(words)){ |
|||
first = strsplit(words[i],"")[[1]][1:nchar(words[i])-1] |
|||
second = strsplit(words[i],"")[[1]][2:nchar(words[i])] |
|||
ordered[i] = all(first<=second) |
|||
} |
|||
cat(words[ordered][which(nchar(words[ordered])==max(nchar(words[ordered])))],sep="\n") |
|||
{{Out}} |
{{Out}} |
||
<pre>abbott |
<pre>abbott |