## Problem 1: Coded Message

You have just found the secret instructions on how to encode a message:

"Calculate the message length and round up to the nearest multiple of 5. Write out the message in rows of 5 characters each until the message is complete. Send the message a column at at a time from left to right."

For example, suppose the message is THIS IS A CODED MESSAGE.
It is 23 characters long so two spaces are added at the end to make it 25 characters long. The rows of 5 characters are:

```1 2 3 4 5

T H I S
I S   A
C O D E D
M E S S
A G E
```

The characters are sent one column at a time from left to right (a period indicates a space):

`TIC.AHSOMGI.DEESAES...DS`

### Input

The input will consist of 5 commands to encode/decode a message.
The first line of each command is a character to indicate what your program should do: D means decode, E means encode.
The second line of each command will contaibn the text to encode/decode.

### Output

The decoded/encoded message for each test case.

### Sample Input

(note that spaces, not periods will appear in the input/output)
```D
TIC.AHSOMGI.DEESAES...DS
E
MEET.ME.IN.THE.PARK.TONIGHT.AT.SEVEN
```

(and 3 more commands)

### Sample Output

```THIS.IS.A.CODED.MESSAGE..
MM.PTH.NEETAOTS.E.HRN.E.TIEKIAV..N..GTE.```

Point Value: 7
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 29, 2008

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

• (0/0)
Could someone give me some help on my code?

It works fine for the test cases and my own test cases, and I think my logic is correct.

• (0/0)
The sample input is missing a '.' at the end

TIC.AHSOMGI.DEESAES...DS

should be

TIC.AHSOMGI.DEESAES...DS.

• (0/0)

• (2/0)
Less than 30 characters.

• (0/1)
hOW CAN THAT BE WHEN THE SAMPLE IS MORE THAN 30

• (5/0)
It just is. Don't worry, I didn't get to be the admin by not knowing how to count.

• (1/1)
i have no idea how my program only works for one of the inputs!!

• (0/0)
Perhaps you failed to initialize something inside your testcase loop - because the first testcase works and the others don't.

• (0/0)
I've been looking over it, and I'm pretty sure that isn't the problem (of course, I may hve missed it).

• (2/1)
Note: If you want others' help in debugging your code, you would do well to indent it properly, else lest it be unreadable.

• (0/1)
Why is it that in the "Your Output" section for the submissions (for this program) the grey box doesn't appear anymore AT ALL cause for my submissions, not even the sliver of the box shows(for when your program outputs a wrong answer)??

• (0/1)
Click Show/Hide.
Alright, I changed it back to show by default.

• (0/0)
so it doens't matter.

• (0/0)
Read the Help page for more details on this.

• (0/0)
In the sample output

TIC.AHSOMGI.DEESAES...DS

shouldn't there be a . after?

• (0/2)
I THINK IN THE OUTPUT IT SHOULD BE

TIC.AHSOMGI.DEESAES...DS.

• (0/0)
That's what i said.

• (1/1)
the periods are replaced by spaces right?
so output for sample input should be
THIS IS A CODED MESSAGE ??

• (0/5)
are they replaced by spaces or do you keep them as periods?

• (0/0)
since it says '(note that spaces, not periods will appear in the input/output)'

• (2/0)
There are spaces in the input, and they are still spaces in the output.
If there are any periods in the input, then they also stay as periods in the output.