import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author cteam095
*/
public class Bugs {
/**
* @param args the command line arguments
*/
String inputLine
= br.
readLine();
while (inputLine != null) {
String[] split
= inputLine.
split(" ");
int lines
= Integer.
parseInt(split
[0]);
String lastChar
= String.
valueOf(pattern.
charAt(pattern.
length() - 1));
for (int i = 0; i < lines; i++) {
//String line = "printfBUG(\"Hello,world!\\n\");";
int indexOf = temp.indexOf(firstChar);
int indexOf2 = temp.lastIndexOf(lastChar);
int oldLength;
while (indexOf != -1 && indexOf2 != -1) {
prefix = prefix + temp.substring(0, indexOf);
suffix = temp.substring(indexOf2 + 1)+suffix ;
temp = temp.substring(indexOf, indexOf2 + 1);
oldLength = temp.length();
temp = temp.replaceAll(pattern, "");
if (temp.length() == oldLength) {
break;
}
indexOf = temp.indexOf(firstChar);
indexOf2 = temp.lastIndexOf(lastChar);
};
System.
out.
println(prefix
+ temp
+ suffix
);
}
inputLine = br.readLine();
}
}
}