-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1120.c
49 lines (41 loc) · 742 Bytes
/
1120.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <string.h>
#define MAX_LEN 101
int main()
{
char D;
char N[MAX_LEN];
char R[MAX_LEN];
while (scanf("%c %s\n", &D, N) != EOF)
{
if (D == '0' && !strcmp(N, "0"))
{
break;
}
int n = strlen(N);
int p = 0;
for (int i = 0; i < n; ++i)
{
if (N[i] != D)
{
R[p++] = N[i];
}
}
R[p] = '\0';
p = 0;
n = strlen(R);
while (p < n && R[p] == '0')
{
++p;
}
if (p == n)
{
printf("0\n");
}
else
{
printf("%s\n", R + p);
}
}
return 0;
}