Decode
Practice
3.9 (20 votes)
Algorithms
Easy
String manipulation
Problem
72% Success 6258 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an encrypted message, Erwin encodes it the following way:

Removes the median letter of the word from the original word and appends it to the end of the encrypted word and repeats the process until there are no letters left.

A median letter in a word is the letter present in the middle of the word and if the word length is even, the median letter is the left one out of the two middle letters.

Given an encoded string, write a program to decode it.

Input Format:

The first line of input contains T, the number of test cases.
Each test case contains a String S, denoting the encoded word.

Output Format:

Print the decoded word for each test case in a separate line.

Constraints

\(1 \le T \le 100 \)
\(1 \le |S| \le 100000 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
96 votes
Tags:
AlgorithmsBrute ForceEasyString Manipulationeasy
Points:20
2 votes
Tags:
AlgorithmsBasics of String ManipulationString Algorithms
Points:20
45 votes
Tags:
Ad-HocApprovedEasyOpen