RosettaCodeData/Task/Odd-word-problem/M2000-Interpreter/odd-word-problem-2.m2000
2023-07-01 13:44:08 -04:00

22 lines
585 B
Text

Module OddWord {
k$=lambda$->""
state=false
odd=True
do {
a$=key$
if a$ ~"[a-zA-Z]" then {
If state Else state~ : odd~
if state and odd then k$=lambda$ k$, a$->a$+k$() : Continue
Print a$;
} Else {
If state Then state~
if odd then Print k$(); : k$=lambda$->""
Print a$;
}
} until a$="."
Print
}
keyboard "what,is,the;meaning,of:life."
OddWord
Keyboard "we,are;not,in,kansas;any,more."
OddWord