#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ getLargestNumAfterRemoveDigit(char *, int, int, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int numDigitPresent, numDigitRemove;
  char digitStr[100010 + 1], resultDigitStr[100010 + 1];
  while (1) {
    scanf("%d %d", &numDigitPresent, &numDigitRemove);
    if (numDigitPresent == 0 && numDigitRemove == 0)
      break;
    scanf("%s", digitStr);
    getLargestNumAfterRemoveDigit(digitStr, numDigitPresent, numDigitRemove,
                                  resultDigitStr);
    printf("%s\n", resultDigitStr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1171 <main+0x41>
cmpl   $0x0,-0xc(%rbp)
jne    1171 <main+0x41>
jmp    11b7 <main+0x87>
lea    -0x186c0(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x186c0(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x30d70(%rbp),%rcx
call   1040 <getLargestNumAfterRemoveDigit@plt>
lea    -0x30d70(%rbp),%rsi
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x30d70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30d78,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
or     0x8(%rsp),%eax
je     11d9 <main+0xa9>
lea    0x186c0(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe92(%rip),%r12
lea    0xe82(%rip),%r13
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
nopl   0x0(%rax,%rax,1)
lea    0xe6f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <getLargestNumAfterRemoveDigit@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
or     0x8(%rsp),%eax
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x30d78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100011 x i8]
%5 = alloca [100011 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %0, %14
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %24
14: ; preds = %10, %6
%15 = getelementptr inbounds [100011 x i8], [100011 x i8]* %4, i64 0, i64 0
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [100011 x i8], [100011 x i8]* %4, i64 0, i64 0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = getelementptr inbounds [100011 x i8], [100011 x i8]* %5, i64 0, i64 0
%21 = call i32 @getLargestNumAfterRemoveDigit(i8* %17, i32 %18, i32 %19, i8* %20)
%22 = getelementptr inbounds [100011 x i8], [100011 x i8]* %5, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %6
24: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100011 x i8]
%4 = alloca [100011 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [100011 x i8], [100011 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [100011 x i8], [100011 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %27, label %15
15: ; preds = %0, %15
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @getLargestNumAfterRemoveDigit(i8* %7, i32 %17, i32 %18, i8* %8)
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%22 = load i32, i32* %1
%23 = icmp eq i32 %22, 0
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 0
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %27, label %15
27: ; preds = %15, %0
ret i32 0
}