2014 Mock CCC by Alex and Timothy
Problem J2: Rope Unfolding
Alice's love potion failed because Bob overdosed. Now, her new tactic is to impress Bob. Bob is a computer scientist who specializes in ropes. In computer science, a rope is a data structure used for efficiently manipulating strings. Bob has a rope of characters. However, it's too long to fit in his pocket, so he folds it into N segments. Each fold is at a letter which is not the last. The fold takes the rest of the rope after that letter, reverses it, and puts it above the current letter. For example, the rope "
ABRACADABRA", when folded "
AR DAB ACAR AB
Alice notices that Bob often gets a headache pulling the rope out of his pocket and spending a long time untangling it. She concludes that if she finds a way to unfold it for Bob, Bob will be so impressed that he can't help but fall madly in love with her. You must write a program to help Alice!
The first line of input will contain the positive integer N (1 ≤ N ≤ 100), the number of lines to follow. The next N lines each contain a segment of the folded rope.
The entire, unfolded rope will be no greater than 100 characters, and will only consist of uppercase letters from 'A' to 'Z'.
The output should contain one line — the unfolded rope.
Sample Input 1
4 AR DAB ACAR AB
Sample Output 1
Sample Input 2
5 D LRO W OL HEL
Sample Output 2
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 27, 2014
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3