Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

The Haunted House

By Jakaria_MU · Limits 1s, 512 MB

One night, a group of friends decided to take a stroll through the forest. Suddenly they realized that they had lost their way.

They tried to find their way back to the city, but instead they found an abandoned house. They went inside since they had no other way.

Turns out there ghosts living in the house. The ghosts decided to gave them some hints that the house was haunted. Some ghosts started writing some messages on the walls.

Turns out, you know that the only way to fight these ghosts is to reverse the first half of the length of their message and write them back on the wall. Since you are a good programmer, you know how to help them.

Input

The input begins with an integer $T$ ($1 \le T \le 100$) denoting the number of test cases. Each of the following test cases consist a string of any order of at most 50 characters.

Output

Print the first half of the message, reversed.

Sample

InputOutput
3
WeWillAttackOnYou
WeWillKillYou
GetOutOfHere.
tAlliWeW
lliWeW
tuOteG

Discussion

Statistics


97% Solution Ratio

RabelAhmedEarliest, Jul '17

raselrokyFastest, 0.0s

mdvirusLightest, 0 B

t90_opoShortest, 63B

Submit

Login to submit