Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
37
Task/Ordered-words/Ring/ordered-words.ring
Normal file
37
Task/Ordered-words/Ring/ordered-words.ring
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
fn = "C:\Ring\unixdict.txt"
|
||||
|
||||
fp = fopen(fn,"r")
|
||||
str = fread(fp, getFileSize(fp))
|
||||
str = substr(str, windowsnl(), nl)
|
||||
clist = str2list(str)
|
||||
fclose(fp)
|
||||
dlist = []
|
||||
|
||||
for m = 1 to len(clist)
|
||||
flag = 1
|
||||
for n = 1 to len(clist[m])-1
|
||||
if ascii(clist[m][n+1]) < ascii(clist[m][n])
|
||||
flag=0 exit ok
|
||||
next
|
||||
if flag = 1
|
||||
add(dlist, clist[m]) ok
|
||||
next
|
||||
|
||||
nr = 0
|
||||
for m = 1 to len(dlist)
|
||||
if len(dlist[m]) > nr
|
||||
nr = len(dlist[m]) ok
|
||||
next
|
||||
|
||||
for n = 1 to len(dlist)
|
||||
if len(dlist[n]) = nr
|
||||
see dlist[n] + nl ok
|
||||
next
|
||||
|
||||
func getFileSize fp
|
||||
c_filestart = 0
|
||||
c_fileend = 2
|
||||
fseek(fp,0,c_fileend)
|
||||
nfilesize = ftell(fp)
|
||||
fseek(fp,0,c_filestart)
|
||||
return nfilesize
|
||||
Loading…
Add table
Add a link
Reference in a new issue