RosettaCodeData/Task/Odd-word-problem/M2000-Interpreter/odd-word-problem-2.m2000

23 lines
585 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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