Phoenix And Distribution

easy
<a href="https://codeforces.com/problemset/problem/1348/C" target="_blank"><i class="fa fa-external-link" aria-hidden="true"> Link -> Phoenix and Distribution</i></a>

Input Format

check the link

Output Format

check the link

Constraints

check the link

Example

Input
6
4 2
baba
5 2
baacb
5 3
baacb
5 3
aaaaa
6 4
aaxxzz
7 1
phoenix
Output
ab
abbc
b
aa
x
ehinopx
Previous
Remove Adjacent
Next
Make Palindrome

Related Questions