You
need patient to solve this problem. There are some important
ponts.
�
Your
first task is to reverse the input string in the case of encoded
massage
�
Every
normal message have alphabet and punctuation and no numbers.
�
Every
encoded message consists numbers only.
�
Those
alphabet whose ASCII value is three digit, all will start with 1
and remaning will be started with other than 1.
The
algorithm is as follows.
1.
Read ->str
2.
if str[0] is a
digit
3.
then decode str
4.
else encode str
Algorithm
of decode
1.
Reverse str
2.
l <- length str
3.
for i =0 to l
4.
if str[i] = 1
5.
then get three character and make it integer a.
6.
i = i+3;
7.
else get two character and make integer a.
8.
i = i+2;
9.
print character represented by a.
Algorithm
of encode
1.
l <-
length str
2.
for i =0 to l
3.
strtmp[i]
= ascii str[i]
4.
reverse str
|