Problem1031--Delete characters again

1031: Delete characters again

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

Given a string S and an integer K, the task is to reduce the string by applying the following operation:
Choose a group of K consecutive identical characters and remove them. 
The operation can be performed any number of times until it is no longer possible

Input

One string which is S and one integer which is K  (You can assume all lower case letters)
1<= |S| <= 1000,000
1<= K <= |S|

Output

The final string. (if it is empty string, just output "DELETE ALL" )

Sample Input Copy

google 2

Sample Output Copy

le

Source/Category