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
|
|
@ -0,0 +1,23 @@
|
|||
integer fn = open(command_line()[2],"r") -- (reading the source file)
|
||||
|
||||
function allx(string line)
|
||||
line[1..-1] = 'x'
|
||||
return line
|
||||
end function
|
||||
|
||||
function longest(string mask)
|
||||
object line = gets(fn)
|
||||
string newmask
|
||||
if atom(line) then return mask end if
|
||||
newmask = allx(line)
|
||||
if not match(mask,newmask) then return longest(mask) end if
|
||||
mask = longest(newmask)
|
||||
if match(mask,newmask) then
|
||||
puts(1,line)
|
||||
end if
|
||||
return mask
|
||||
end function
|
||||
|
||||
?longest("x")
|
||||
|
||||
close(fn)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
function longest(integer l)
|
||||
object line = gets(fn)
|
||||
if line=-1 then return l end if
|
||||
if l>length(line) then return longest(l) end if
|
||||
l = longest(length(line))
|
||||
if l=length(line) then
|
||||
puts(1,line)
|
||||
end if
|
||||
return l
|
||||
end function
|
||||
|
||||
?longest(0)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
var l = ''; # Sample longest string seen.
|
||||
var a = ''; # Accumulator to save longest strings.
|
||||
|
||||
STDIN.each { |n|
|
||||
n.substr(l.len) ? (a = n; l = n)
|
||||
: (!l.substr(n.len) && a.concat!(n));
|
||||
}
|
||||
|
||||
print a;
|
||||
Loading…
Add table
Add a link
Reference in a new issue