REVINPUT - Reverse the Input

no tags 

A simple task is a rare thing in SPOJ these days. If you are looking for one, then this is just the task for you! All you need to do is to reverse the input N times.

Score is the length of your solution.

Input

The first lines of the input is an integer N (1 <= N <= 100). Next follows the input consisting of ASCII characters. The input is terminated by EOF. You may assume that length of each word is less then 1024 and maximum number of words can be never more than 1024.

Output

The input reversed N times with at least a space/newline between any two words of your output.

Example

Input:
2
fox jumps over the lazy dog.

Output:
.god .god yzal yzal eht eht revo revo spmuj spmuj xof xof
Input:
1
It matters not how strait the gate,
How charged with punishments the scroll.
I am the master of my fate:
I am the captain of my soul.

Output:
.luos ym fo niatpac eht ma I
:etaf ym fo retsam  eht ma I
.llorcs eht stnemhsinup htiw degrahc woH
,etag eht tiarts woh ton srettam tI

hide comments
dwij28: 2015-09-29 22:31:23

I was happy with a score of 125 but then I saw the leaderboard.. LOL on me :P
EDIT: somehow made it to 75, I will stop now, golfing energy left == NULL..

Last edit: 2016-01-13 10:34:03
Mitch Schwartz: 2015-03-22 15:30:01

@Daniel Carvalho: The standard judge is being used, so any runs of consecutive whitespace characters are treated as equivalent.

Daniel Carvalho: 2015-03-22 14:37:54

I keep getting WA. Before I waste any more time on this, does "The input reversed N times with atleast a space/newline between any two words of your output." means that I can choose if I'm going to output spaces/new lines, or do I have to put new lines after each sentence and spaces within words in a sentence?

New_Bullet: 2014-10-04 23:39:12

Need help! How do I read till EOF in c?
I used scanf("%[^EOF]s",str) to read input. I'm getting WA. Can someone say if there should be a '\n' or not, at the end of the input string?

Harshit: 2014-06-01 09:07:32

where is the problem statement ??

Mitch Schwartz: 2014-05-07 18:15:26

I wrote about this before but the comment was lost: According to my tests, the input is pretty well behaved: the space character and "\n" are the only whitespace characters that occur; two whitespace characters in a row do not occur; and the only strange thing is that the last line is never terminated with "\n", and sometimes there is a trailing space and sometimes there isn't.


Added by::(){ :|: & };:
Date:2010-08-13
Time limit:1s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All