Odd word problem: Difference between revisions

no edit summary
(added Ol)
No edit summary
Line 1,494:
Should have:
what,si,the;gninaem,of:efil.</pre>
 
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Module Checkit {
Function PrepareStream$ (buf$) {
\\ get a temporary file
name$=tempname$
\\ we use Ansi type files
Open name$ for output as F
Print #F, buf$;
Close #F
Open name$ for input as #f
=lambda$ f -> {
if f=-1000 then exit
def r$
if not eof(#f) then r$=Input$(#f,2)
=r$
if r$="" then close #f : f=-1000
}
}
Module Odd(c$) {
one$=""
Module MyEven(c$, &last$) {
one$=If$(last$=""->c$(), last$)
if one$="" then exit
if not one$ ~"[a-z]" Then last$=one$: exit
\\ print before
Print one$;
Call MyOdd, c$, &last$
}
Module MyOdd(c$, &last$) {
one$=If$(last$=""->c$(), last$)
if one$="" then exit
if not one$ ~"[a-z]" Then last$=one$: exit
Call MyOdd, c$, &last$
\\ print after
Print one$;
}
Do {
one$=""
Call MyEven, c$, &one$
if one$="" then exit
Print one$;
one$=""
Call MyOdd, c$, &one$
if one$="" then exit
Print one$;
} Always
Print
}
Odd PrepareStream$("what,is,the;meaning,of:life.")
Odd PrepareStream$("we,are;not,in,kansas;any,more.")
}
Checkit
</lang>
{{out}}
<pre>
what,si,the;gninaem,of:efil.
we,era;not,ni,kansas;yna,more.
</pre>
 
=={{header|Nim}}==
Anonymous user