## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Make Palindrome 2 CodeChef Solution

You are given a binary string $S$ of length $N$. You want to obtain a palindrome from $S$ by applying the following operation at most $⌊\frac{N}{2}⌋$ times:

• Choose an index $i\phantom{\rule{thickmathspace}{0ex}}\left(1\le i\le |S|\right)$, delete the character ${S}_{i}$ from $S$ and concatenate the remaining parts of the string. Here $|S|$ denotes the current length of string $S$.

For example, if $S=$ 11010, then applying the operation on index $i=2$ makes $S=$ 1010.

Note that after each operation, the length of the string $S$ decreases by one.

Find any palindrome you can obtain after the operations. It can be proved that it is always possible to obtain a palindrome from $S$ under the given constraints.

Solution Click Below:-  👉
👇👇👇👇👇

Here, $⌊\frac{N}{2}⌋$ denotes floor division of the integer $N$ by $2$. For example, $⌊\frac{5}{2}⌋=2$$⌊\frac{8}{2}⌋=4$. A binary string is a string that consists of only the characters 0 and 1.

### Input Format

• The first line of input contains an integer $T$, denoting the number of test cases. The $T$ test cases

•  then follow:
• The first line of each test case contains an integer $N$, denoting the length of the binary string $S$.
• The second line of each test case contains the binary string $S$.

### Output Format

For each test case, print on a separate line any palindromic string that can be obtained from $S$ by applying the given operation at most $⌊\frac{N}{2}⌋$ times.

### Constraints

• $1\le T\le 1000$
• $1\le N\le 100$
• $S$ contains only the characters 0 and 1.