|
Problem # 3 : The Dollar code
Given a sentence
it is coded in the following manner :
a) A "$" sign is added to each word.
b) Each word is placed in a separate line.
c) After all words
a "$" is added to a new line.
d) By taking one character from each word at a time we get the code.
For example the sentence : "This is an example stop" will be written
as -
This$
is$
an$
example$
stop$
$
and will be coded as - "Tiaes$hsnxti$$aosmp$p$le$"
Write a function DECODE(A$) which decodes a sentence encoded in this
fashion.
While you're at it
write a function ENCODE(A$) which will encode a
sentence.
Sample Output
DECODE$("Yhsctc$oaurhouvcaed$ecc$e$ek$sesdf$ully$")
should return - You have successfully cracked
the code
and
ENCODE$("You have successfully cracked the code")
should return - Yhsctc$oaurhouvcaed$ecc$e$ek$sesdf$ully$
|