847. Non-Allergic String

0

Medium

Bob is allergic to strings that contain adjacent characters of the same type, with a maximum of k repetitions. Given a string s and an integer k, a k-duplicate removal involves selecting k adjacent and identical letters from s and removing them, resulting in the concatenation of the remaining substrings on both sides of the deleted substring. This process is repeated until no further removals can be made. Print the final non-allergic string.

Input Format

The first line contains a single integer k. The second line contains a string s.

Output Format

Print the final non-allergic string.

Example

Input

2 CooodddingBlllllocks

Output

CodingBlocks

Constraints

1 <= N <= 10^4, 1 <= k <= N
Loading...

View Submissions

Console