Rebus
Time limit2sMemory limit512 MB
Split the input into space-separated words, strip leading and trailing apostrophes by removing that many letters from each end, then concatenate the pieces.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
In the last English lesson, Petya was given homework. It consisted of solving rebuses. Each rebus is a sequence of pictures. Apostrophes may appear on either side of each picture. Each picture stands for a word. Suppose there are apostrophes before some picture and apostrophes after it. This means that from the word matched to the picture, letters must be removed from the beginning and from the end, and the remaining part must be written in place of the picture and the apostrophes. This must be done for every picture and the apostrophes around it. After that, the resulting pieces must be glued into a single word. That word is the answer to the rebus.
Petya has no trouble matching a word to each picture. But he is very lazy about removing extra letters and gluing words together. So he asked you to help him. You are given a string made of lowercase Latin letters, apostrophes (character code 39), and spaces that separate words. An apostrophe belongs to a word if there is no space between them. If an apostrophe is to the left of a word, one letter must be removed from the beginning; if it is to the right, one letter must be removed from the end. Then all the words must be glued into one.
For example, suppose the string <<team ''''school ''olympiad'''>> is given. Nothing needs to be changed in the first word because no apostrophe belongs to it. In the second word, the first four letters must be removed, giving <<ol>>; from the third word we get <<ymp>>. Gluing the three pieces gives the string <<teamolymp>>.
Input
The first line of the input file contains the rebus to solve, with length at most characters. It is guaranteed that the string contains only apostrophes (character code 39), spaces, and lowercase Latin letters, and that the rebus is correct: no word has more letters to remove than its length.
Output
Print a single word, the answer to the rebus.